Mercurial > dive4elements > river
changeset 553:c5fc3fa02edb
The MouseOut event will now finish a current pan operation.
flys-client/trunk@2067 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 07 Jun 2011 13:58:38 +0000 |
parents | 6050d49eaba3 |
children | ad2ba6e2b8bd |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java |
diffstat | 3 files changed, 53 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * 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 <ingo@intevation.de> * src/main/java/de/intevation/flys/client/shared/model/Axis.java: New.
--- 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; }
--- 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); }