# HG changeset patch # User Ingo Weinzierl # Date 1307455118 0 # Node ID c5fc3fa02edbce7f13249a40fb5529750231f7dd # Parent 6050d49eaba35dcc934552769cf2cd8f47d6d3b6 The MouseOut event will now finish a current pan operation. flys-client/trunk@2067 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 6050d49eaba3 -r c5fc3fa02edb flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Jun 07 13:26:24 2011 +0000 +++ b/flys-client/ChangeLog Tue Jun 07 13:58:38 2011 +0000 @@ -1,3 +1,9 @@ +2011-06-07 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java: + Implemented the onMouseOut() method. If this event is catched, the + current pan operation is finished (not canceled). + 2011-06-07 Ingo Weinzierl * src/main/java/de/intevation/flys/client/shared/model/Axis.java: New. diff -r 6050d49eaba3 -r c5fc3fa02edb flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java Tue Jun 07 13:26:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java Tue Jun 07 13:58:38 2011 +0000 @@ -8,6 +8,7 @@ import com.smartgwt.client.types.Overflow; import com.smartgwt.client.types.SelectionType; import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.ImgButton; import com.smartgwt.client.widgets.events.MouseDownEvent; import com.smartgwt.client.widgets.events.MouseDownHandler; @@ -147,7 +148,52 @@ * @param event The mouse out event. */ public void onMouseOut(MouseOutEvent event) { - // TODO Cancel dragging if mouse pointer leaves chart area + int x = event.getX(); + int y = event.getY(); + + if (!isSelected() || !isMouseOut(x, y) || start[0] == -1) { + return; + } + + Canvas parent = chartTab.getChartPanel().getParentElement(); + parent.setOverflow(Overflow.AUTO); + + fireOnPan(); + + start[0] = -1; + start[1] = -1; + } + + + /** + * This method is required to check manually if the mouse pointer really + * moves out the chart area. The MouseOutEvent is also fired if the mouse + * goes down which doesn't seem to be correct. So, we gonna check this + * manually. + * + * @param x The x coordinate. + * @param y The y coordinate. + * + * @return true, if the mouse is really out of the chart area, otherwise + * false. + */ + protected boolean isMouseOut(int x, int y) { + Canvas chart = chartTab.getChartPanel(); + + if (chart instanceof Img) { + chart = chart.getParentElement(); + } + + int left = chart.getPageLeft(); + int right = chart.getPageRight(); + int top = chart.getPageTop(); + int bottom = chart.getPageBottom(); + + if (x <= left || x >= right || y <= top || y >= bottom) { + return true; + } + + return false; } diff -r 6050d49eaba3 -r c5fc3fa02edb flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java Tue Jun 07 13:26:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java Tue Jun 07 13:58:38 2011 +0000 @@ -92,8 +92,6 @@ Axis[] xAxes = parseXAxes(doc); Axis[] yAxes = parseYAxes(doc); - de.intevation.flys.client.server.XMLDebug.out(doc); - return new ChartInfo(xAxes, yAxes, transformer); }