MousePos findMousePosition(MouseEvent evt)
{
- return findMousePosition(evt, false);
+ return findMousePosition(evt, null);
}
/**
* @param evt
* @return
*/
- MousePos findMousePosition(MouseEvent evt, boolean debug)
+ MousePos findMousePosition(MouseEvent evt, String debug)
{
int col = findColumn(evt, debug);
int seqIndex = -1;
int charHeight = av.getCharHeight();
int alignmentHeight = av.getAlignment().getHeight();
- if (debug)
+ if (debug != null)
{
System.out.println(String.format(
- "charHeight %d alHeight %d canvasWidth %d canvasHeight %d",
- charHeight, alignmentHeight, seqCanvas.getWidth(),
+ "%s: charHeight %d alHeight %d canvasWidth %d canvasHeight %d",
+ debug, charHeight, alignmentHeight, seqCanvas.getWidth(),
seqCanvas.getHeight()));
}
if (av.getWrapAlignment())
*/
int findColumn(MouseEvent evt)
{
- return findColumn(evt, true);
+ return findColumn(evt, null);
}
- int findColumn(MouseEvent evt, boolean debug)
+ int findColumn(MouseEvent evt, String debug)
{
int res = 0;
int x = evt.getX();
int y = evt.getY();
y = Math.max(0, y - hgap);
x -= seqCanvas.getLabelWidthWest();
- if (debug)
+ if (debug != null)
{
System.out.println(
- String.format("findColumn: x %d labelWest %d charWidth %d ",
+ String.format("%s: x %d labelWest %d charWidth %d ", debug,
x, seqCanvas.getLabelWidthWest(), charWidth));
}
if (x < 0)
}
if (x >= cwidth * charWidth)
{
- if (debug)
+ if (debug != null)
{
- System.out.println("findColumn: cwidth = " + cwidth);
+ System.out.println(debug + ": cwidth = " + cwidth);
}
// mouse is over right scale
return -1;
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y,
0, 0, 0, false, 0);
- MousePos pos = testee.findMousePosition(evt);
+ MousePos pos = testee.findMousePosition(evt, "291");
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y,
0, 0, 0, false, 0);
- MousePos pos = testee.findMousePosition(evt);
+ MousePos pos = testee.findMousePosition(evt, "466");
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, y,
0, 0, 0, false, 0);
- MousePos pos = testee.findMousePosition(evt);
+ MousePos pos = testee.findMousePosition(evt, "662");
assertEquals(pos.column, 0);
assertEquals(pos.seqIndex, -1); // above sequences
assertEquals(pos.annotationIndex, -1);
*/
MouseEvent evt = new MouseEvent(testee, Event.MOUSE_MOVE, 0L, 0, x, 0,
0, 0, 0, false, 0);
- assertEquals(testee.findColumn(evt), 0);
+ assertEquals(testee.findColumn(evt, "808"), 0);
/*
* not quite one charWidth across