X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FRotatableCanvas.java;h=c7696a0f6dce1644265c351245f671a8e41495c6;hb=4232f0a5699af84c5361e6cea446a97e7bcc788e;hp=b27ab8ae06d39173cd04aefd00ebd550ea914c76;hpb=f85c8c88d6947b9f290409f1271429144df2c120;p=jalview.git diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index b27ab8a..c7696a0 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -36,6 +36,8 @@ public class RotatableCanvas RotatableMatrix idmat = new RotatableMatrix(3, 3); RotatableMatrix objmat = new RotatableMatrix(3, 3); RotatableMatrix rotmat = new RotatableMatrix(3, 3); + String tooltip; + int toolx, tooly; //RubberbandRectangle rubberband; @@ -291,13 +293,12 @@ public class RotatableCanvas return getPreferredSize(); } + public void update(Graphics g) + { + paint(g); + } public void paint(Graphics g) { - if (!jalview.bin.JalviewLite.AWT1) - { - MyGraphics.AntiAlias(g); - } - if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); @@ -328,6 +329,12 @@ public class RotatableCanvas drawAxes(ig); } + if(tooltip!=null) + { + ig.setColor(Color.red); + ig.drawString(tooltip, toolx, tooly); + } + g.drawImage(img, 0, 0, this); } } @@ -394,14 +401,7 @@ public class RotatableCanvas getName(), x - 3, y - 4); } - } -// //Now the rectangle -// if (rectx2 != -1 && recty2 != -1) { -// g.setColor(Color.white); -// -// g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1); -// } } public Dimension minimumsize() @@ -512,27 +512,26 @@ public class RotatableCanvas repaint(); } - // private void fireSequenceSelectionEvent(Selection sel) { - // controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel)); - //} public void mouseMoved(MouseEvent evt) { - // SequenceI found = findPoint(evt.getX(), evt.getY()); + SequenceI found = findPoint(evt.getX(), evt.getY()); + if(found==null) + tooltip = null; + else + { + tooltip = found.getName(); + toolx = evt.getX(); + tooly = evt.getY(); + } + repaint(); } public void mouseDragged(MouseEvent evt) { mx = evt.getX(); my = evt.getY(); - //Check if this is a rectangle drawing drag - if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) - { -// rectx2 = evt.getX(); -// recty2 = evt.getY(); - } - else - { + rotmat.setIdentity(); rotmat.rotate( (float) (my - omy), 'x'); @@ -562,8 +561,6 @@ public class RotatableCanvas omy = my; paint(this.getGraphics()); - } - } public void rectSelect(int x1, int y1, int x2, int y2) @@ -619,26 +616,5 @@ public class RotatableCanvas return null; } } - /* public boolean handleRubberbandEvent(RubberbandEvent evt) { - System.out.println("Rubberband handler called in RotatableCanvas with " + - evt.getBounds()); - - Rubberband rb = (Rubberband)evt.getSource(); - - // Clear the current selection (instance variable) - //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) { - // clearSelection(); - //} - - if (rb.getComponent() == this) { - Rectangle bounds = evt.getBounds(); - rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height); - } - - redrawneeded = true; - paint(this.getGraphics()); - - return true; - }*/ }