Skip to content

Commit fcf05e3

Browse files
fix note coords
1 parent 60c16aa commit fcf05e3

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

jmathplot/src/org/math/plot/canvas/PlotCanvas.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -630,14 +630,15 @@ public void paint(Graphics gcomp) {
630630
linkedLegendPanel.note(i);
631631
}
632632
getPlot(i).note(draw);
633-
if (allowNoteCoord && coordNoted != null) {
634-
getPlot(i).noteCoord(draw, coordNoted);
635-
}
636633
//return;
637634
}
635+
if (allowNoteCoord && coordNoted != null) {
636+
getPlot(i).noteCoord(draw, coordNoted);
637+
}
638638
}
639639
}
640640
}
641+
641642
// ///////////////////////////////////////////
642643
// ////// Listeners //////////////////////////
643644
// ///////////////////////////////////////////
@@ -715,14 +716,15 @@ public void mouseReleased(MouseEvent e) {
715716
if (abs(mouseCurent[0] - mouseClick[0]) > 10 && abs(mouseCurent[1] - mouseClick[1]) > 10) {
716717
int[] origin = {min(mouseClick[0], mouseCurent[0]), min(mouseClick[1], mouseCurent[1])};
717718
double[] ratio = {abs((double) (mouseCurent[0] - mouseClick[0]) / (double) getWidth()),
718-
abs((double) (mouseCurent[1] - mouseClick[1]) / (double) getHeight())
719+
abs((double) (mouseCurent[1] - mouseClick[1]) / (double) getHeight())
719720
};
720721
draw.dilate(origin, ratio);
721722
repaint();
722723
}
723724
break;
724725
}
725726
//repaint();
727+
dragging = false;
726728
}
727729

728730
public void mouseClicked(MouseEvent e) {
@@ -835,21 +837,21 @@ public void mouseWheelMoved(MouseWheelEvent e) {
835837
int[] origin;
836838
double[] ratio;
837839
// double factor = 1.5;
838-
switch (ActionMode) {
839-
case ZOOM:
840-
if (e.getWheelRotation() == -1) {
841-
origin = new int[]{(int) (mouseCurent[0] - getWidth() / 3/* (2*factor) */), (int) (mouseCurent[1] - getHeight() / 3/* (2*factor) */)};
842-
ratio = new double[]{0.666/* 1/factor, 1/factor */, 0.666};
843-
} else {
844-
origin = new int[]{(int) (mouseCurent[0] - getWidth() / 1.333/* (2/factor) */),
845-
(int) (mouseCurent[1] - getHeight() / 1.333/* (2/factor) */)
846-
};
847-
ratio = new double[]{1.5, 1.5 /* factor, factor */};
848-
}
849-
draw.dilate(origin, ratio);
850-
repaint();
851-
break;
840+
//switch (ActionMode) {
841+
// case ZOOM:
842+
if (e.getWheelRotation() == -1) {
843+
origin = new int[]{(int) (mouseCurent[0] - getWidth() / 3/* (2*factor) */), (int) (mouseCurent[1] - getHeight() / 3/* (2*factor) */)};
844+
ratio = new double[]{0.666/* 1/factor, 1/factor */, 0.666};
845+
} else {
846+
origin = new int[]{(int) (mouseCurent[0] - getWidth() / 1.333/* (2/factor) */),
847+
(int) (mouseCurent[1] - getHeight() / 1.333/* (2/factor) */)
848+
};
849+
ratio = new double[]{1.5, 1.5 /* factor, factor */};
852850
}
851+
draw.dilate(origin, ratio);
852+
repaint();
853+
// break;
854+
//}
853855
}
854856

855857
public void componentHidden(ComponentEvent e) {

0 commit comments

Comments
 (0)