Mercurial > dive4elements > river
changeset 610:ea2191b1299d
#170 Changed the DOM manipulation while zoom and drag operation.
flys-client/trunk@2223 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 23 Jun 2011 17:46:08 +0000 (2011-06-23) |
parents | 418be98527f0 |
children | 854312c0528c |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java flys-client/src/main/java/de/intevation/flys/client/shared/Transform2D.java flys-client/src/main/java/de/intevation/flys/client/shared/model/ChartInfo.java |
diffstat | 5 files changed, 78 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Thu Jun 23 17:16:08 2011 +0000 +++ b/flys-client/ChangeLog Thu Jun 23 17:46:08 2011 +0000 @@ -1,3 +1,19 @@ +2011-06-23 Ingo Weinzierl <ingo@intevation.de> + + flys/issue170 (Diagramm: Initiales Zoomen zeigt verschobenen Bereich) + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + The chart image is no longer removed from DOM but it's source is set to + a new value after the panel's size changes. This makes the zoom actions + much smoother and there the initial zoom values are no longer broken. + + * src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java: + Panning will now move the image itself but not its parent element. + + * src/main/java/de/intevation/flys/client/shared/model/ChartInfo.java, + src/main/java/de/intevation/flys/client/shared/Transform2D.java: Added + methods to dump the objects to GWT log. + 2011-06-23 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Jun 23 17:16:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Jun 23 17:46:08 2011 +0000 @@ -7,6 +7,8 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.types.Overflow; + import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Img; @@ -72,6 +74,8 @@ /** The canvas that wraps the chart.*/ protected Canvas right; + protected Img chart; + /** Chart zoom options.*/ protected int[] xrange; @@ -122,7 +126,10 @@ ChartThemePanel ctp = new ChartThemePanel(collection, mode); ctp.addOutputParameterChangeHandler(this); - right.addChild(createChartPanel()); + chart = createChartImg(); + right.addChild(chart); + right.setOverflow(Overflow.HIDDEN); + //right.addChild(createChartPanel()); left.addChild(ctp); vLayout.addMember(tbarPanel); @@ -357,7 +364,7 @@ getChartAttributes(), new AsyncCallback<ChartInfo>() { public void onFailure(Throwable caught) { - GWT.log("ERROR: " + caught.getMessage()); + GWT.log("ChartInfo ERROR: " + caught.getMessage()); } public void onSuccess(ChartInfo chartInfo) { @@ -368,12 +375,10 @@ public void updateChartPanel() { - Canvas[] children = right.getChildren(); - for (Canvas child: children) { - right.removeChild(child); - } + int w = right.getWidth(); + int h = right.getHeight(); - right.addChild(createChartPanel(right.getWidth(), right.getHeight())); + chart.setSrc(getImgUrl(w, h)); } @@ -383,14 +388,12 @@ * @return the existing chart panel. */ public Canvas getChartPanel() { - Canvas[] children = right.getChildren(); + return right; + } - if (children == null || children.length == 0) { - GWT.log("=> No chart image in the panel."); - return right; - } - return children[0]; + public Canvas getChartImg() { + return chart; } @@ -435,8 +438,8 @@ * * @return the created chart panel. */ - protected Canvas createChartPanel() { - return createChartPanel(DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT); + protected Img createChartImg() { + return createChartImg(DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT); } @@ -448,7 +451,7 @@ * * @return the created chart panel. */ - protected Canvas createChartPanel(int width, int height) { + protected Img createChartImg(int width, int height) { Img chart = getChartImg(width, height); chart.setWidth100(); chart.setHeight100(); @@ -496,8 +499,6 @@ double[] zoom = getZoomValues(); if (zoom != null) { - GWT.log("Zoom to specified range."); - imgUrl += "&minx=" + Double.toString(zoom[0]); imgUrl += "&maxx=" + Double.toString(zoom[1]); imgUrl += "&miny=" + Double.toString(zoom[2]);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java Thu Jun 23 17:16:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/PanControl.java Thu Jun 23 17:46:08 2011 +0000 @@ -84,9 +84,6 @@ return; } - Canvas parent = chartTab.getChartPanel().getParentElement(); - parent.setOverflow(Overflow.HIDDEN); - start[0] = event.getX(); start[1] = event.getY(); @@ -113,7 +110,7 @@ end[0] = end[0] + x; end[1] = end[1] + y; - Canvas c = chartTab.getChartPanel(); + Canvas c = chartTab.getChartImg(); c.moveBy(x, y); } @@ -132,8 +129,9 @@ end[0] = event.getX(); end[1] = event.getY(); - Canvas parent = chartTab.getChartPanel().getParentElement(); - parent.setOverflow(Overflow.AUTO); + Canvas c = chartTab.getChartImg(); + c.setLeft(0); + c.setTop(0); fireOnPan(); @@ -155,8 +153,9 @@ return; } - Canvas parent = chartTab.getChartPanel().getParentElement(); - parent.setOverflow(Overflow.AUTO); + Canvas c = chartTab.getChartImg(); + c.setLeft(0); + c.setTop(0); fireOnPan(); @@ -178,7 +177,7 @@ * false. */ protected boolean isMouseOut(int x, int y) { - Canvas chart = chartTab.getChartPanel(); + Canvas chart = chartTab.getChartImg(); if (chart instanceof Img) { chart = chart.getParentElement();
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/Transform2D.java Thu Jun 23 17:16:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/Transform2D.java Thu Jun 23 17:46:08 2011 +0000 @@ -2,6 +2,8 @@ import java.io.Serializable; +import com.google.gwt.core.client.GWT; + /** * This object supports a linear transformation to transform xy coordinates into @@ -48,5 +50,13 @@ return new double[] { resX, resY }; } + + + public void dumpGWT() { + GWT.log("SX = " + sx); + GWT.log("SY = " + sy); + GWT.log("TX = " + tx); + GWT.log("TY = " + ty); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/ChartInfo.java Thu Jun 23 17:16:08 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/ChartInfo.java Thu Jun 23 17:46:08 2011 +0000 @@ -2,6 +2,8 @@ import java.io.Serializable; +import com.google.gwt.core.client.GWT; + import de.intevation.flys.client.shared.Transform2D; @@ -62,5 +64,28 @@ return null; } + + + public void dumpGWT() { + StringBuilder sb = new StringBuilder(); + + Axis x = getXAxis(0); + + GWT.log("X axis:"); + GWT.log("... from " + x.getFrom() + " to " + x.getTo()); + GWT.log("... min " + x.getMin() + " max " + x.getMax()); + + for (int i = 0, count = getYAxisCount(); i < count; i++) { + Axis y = getYAxis(i); + + GWT.log("Y axis " + i + ":"); + GWT.log("... from " + y.getFrom() + " to " + y.getTo()); + GWT.log("... min " + y.getMin() + " max " + y.getMax()); + } + + for (Transform2D t: transformer) { + t.dumpGWT(); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :