X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fviewmodel%2FOverviewDimensions.java;fp=src%2Fjalview%2Fviewmodel%2FOverviewDimensions.java;h=f54c1eb7d64ee33e303037a8f4f9551495a529b0;hb=4a9a2fc8a1b1a66b21e66429083f27a6fc8541b9;hp=7ac07ac93182bc7391c1c14ede0ba4728286568a;hpb=ddbcb3e33e1a8d4c644472cfa3d28b193da97064;p=jalview.git diff --git a/src/jalview/viewmodel/OverviewDimensions.java b/src/jalview/viewmodel/OverviewDimensions.java index 7ac07ac..f54c1eb 100644 --- a/src/jalview/viewmodel/OverviewDimensions.java +++ b/src/jalview/viewmodel/OverviewDimensions.java @@ -192,6 +192,44 @@ public abstract class OverviewDimensions HiddenSequences hiddenSeqs, HiddenColumns hiddenCols); /** + * Update the viewport location from a mouse drag within the overview's box + * + * @param mousex + * x location of mouse + * @param mousey + * y location of mouse + * @param hiddenSeqs + * the alignment's hidden sequences + * @param hiddenCols + * the alignment's hidden columns + */ + public abstract void adjustViewportFromMouse(int mousex, int mousey, + HiddenSequences hiddenSeqs, HiddenColumns hiddenCols); + + /** + * Initialise dragging from the mouse - must be called on initial mouse click + * before using adjustViewportFromMouse in drag operations + * + * @param mousex + * x location of mouse + * @param mousey + * y location of mouse + * @param hiddenSeqs + * the alignment's hidden sequences + * @param hiddenCols + * the alignment's hidden columns + */ + public abstract void setDragPoint(int x, int y, + HiddenSequences hiddenSeqs, HiddenColumns hiddenCols); + + /* + * Move the viewport so that the top left corner of the overview's box + * is at the mouse position (leftx, topy) + */ + protected abstract void updateViewportFromTopLeft(int leftx, int topy, + HiddenSequences hiddenSeqs, HiddenColumns hiddenCols); + + /** * Set the overview panel's box position to match the viewport * * @param hiddenSeqs @@ -225,6 +263,9 @@ public abstract class OverviewDimensions */ protected abstract void resetAlignmentDims(); + /* + * Given the box coordinates in residues and sequences, set the box dimensions in the overview window + */ protected void setBoxPosition(int startRes, int startSeq, int vpwidth, int vpheight) { @@ -241,4 +282,31 @@ public abstract class OverviewDimensions // boxHeight is the height in sequences translated to pixels boxHeight = Math.round((float) vpheight * sequencesHeight / alheight); } + + /** + * Answers if a mouse position is in the overview's red box + * + * @param x + * mouse x position + * @param y + * mouse y position + * @return true if (x,y) is inside the box + */ + public boolean isPositionInBox(int x, int y) + { + return (x > boxX && y > boxY && x < boxX + boxWidth + && y < boxY + boxHeight); + } + + /* + * Given the centre x position, calculate the box's left x position + */ + protected abstract int getLeftXFromCentreX(int mousex, HiddenColumns hidden); + + /* + * Given the centre y position, calculate the box's top y position + */ + protected abstract int getTopYFromCentreY(int mousey, + HiddenSequences hidden); + } \ No newline at end of file