# HG changeset patch # User Ingo Weinzierl # Date 1317300917 0 # Node ID 4782c0ce9cecd75329a4d105e829cc51a67ae550 # Parent 66192d170c7906917a514c43b7599b77ab6da8f5 Re-added the function to zoom-out charts by a given factor (10%). flys-client/trunk@2863 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 66192d170c79 -r 4782c0ce9cec flys-client/ChangeLog --- a/flys-client/ChangeLog Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/ChangeLog Thu Sep 29 12:55:17 2011 +0000 @@ -1,6 +1,23 @@ 2011-09-29 Ingo Weinzierl - flys/issue179 (Zoom Out funktioniert nichtzuverlässig) + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + Re-added the button to zoom-out by a given factor. Added a new one to + step back to the last extent. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + Re-added the function to zoom-out by a given factor. + + * src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants.java: Added + the path to the zoom-back icon. + + * src/main/webapp/images/zoom-back.png: New. Icon for the zoom-back + button. + +2011-09-29 Ingo Weinzierl + flys/issue198 (Diagramm: Zu vorheriger Zoomstufe per Klick zurückkehren) * src/main/java/de/intevation/flys/client/shared/model/ZoomObj.java: New. diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Thu Sep 29 12:55:17 2011 +0000 @@ -100,6 +100,8 @@ String zoom_out(); + String zoom_back(); + String pan(); String fix(); diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Thu Sep 29 12:55:17 2011 +0000 @@ -113,6 +113,7 @@ zoom_all = images/zoom-1.png zoom_in = images/zoom-in.png zoom_out = images/zoom-out.png +zoom_back = images/zoom-back.png pan = images/pan.png discharge_curve = Discharge Curves at Gauges diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Thu Sep 29 12:55:17 2011 +0000 @@ -114,6 +114,7 @@ zoom_all = images/zoom-1.png zoom_in = images/zoom-in.png zoom_out = images/zoom-out.png +zoom_back = images/zoom-back.png pan = images/pan.png discharge_curve = Abflusskurven an Pegeln diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Thu Sep 29 12:55:17 2011 +0000 @@ -108,6 +108,7 @@ zoom_all = images/zoom-1.png zoom_in = images/zoom-in.png zoom_out = images/zoom-out.png +zoom_back = images/zoom-back.png pan = images/pan.png discharge_curve = Discharge Curves at Gauges diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Thu Sep 29 12:55:17 2011 +0000 @@ -320,6 +320,8 @@ public void resetRanges() { + zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3])); + zoom[0] = 0d; zoom[1] = 1d; zoom[2] = 0d; @@ -331,6 +333,34 @@ /** + * This method zooms the current chart out by a given factor. + * + * @param factor The factor should be between 0-100. + */ + public void zoomOut(int factor) { + if (factor < 0 || factor > 100 || chartInfo == null) { + return; + } + + zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3])); + + Axis xAxis = chartInfo.getXAxis(0); + Axis yAxis = chartInfo.getYAxis(0); + + double[] x = zoomAxis(xAxis, factor); + double[] y = zoomAxis(yAxis, factor); + + zoom[0] = x[0]; + zoom[1] = x[1]; + zoom[2] = x[0]; + zoom[3] = y[1]; + + updateChartInfo(); + updateChartPanel(); + } + + + /** * This method is used to zoom out. Zooming out is realizied with a stacked * logic. Initially, you cannot zoom out. For each time you start a zoom-in * action, the extent of the chart is stored and pushed onto a stack. A @@ -351,16 +381,12 @@ double min = axis.getFrom(); double max = axis.getTo(); - GWT.log("ZOOM CURRENT: " + min + " - " + max); - double add = (max - min) / 100 * factor; add = add < 0 ? (-1) * add : add; min -= add; max += add; - GWT.log("ZOOM TO: " + min + " - " + max); - return computeZoom(axis, min, max); } diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Thu Sep 29 11:12:04 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Thu Sep 29 12:55:17 2011 +0000 @@ -43,6 +43,8 @@ protected ImgButton zoomToMaxExtent; + protected ImgButton historyBack; + protected ImgButton zoomOut; protected PanControl panControl; @@ -60,6 +62,7 @@ zoombox = new ZoomboxControl(chartTab, MSG.zoom_in()); zoomToMaxExtent = new ImgButton(); zoomOut = new ImgButton(); + historyBack = new ImgButton(); panControl = new PanControl(chartTab, MSG.pan()); datacage.addClickHandler(new ClickHandler() { @@ -96,6 +99,21 @@ zoomOut.setShowFocusedIcon(false); zoomOut.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { + getChartOutputTab().zoomOut(10); + } + }); + + historyBack.setSrc(baseUrl + MSG.zoom_back()); + historyBack.setWidth(20); + historyBack.setHeight(20); + historyBack.setShowDown(false); + historyBack.setShowRollOver(false); + historyBack.setShowDisabled(false); + historyBack.setShowDisabledIcon(true); + historyBack.setShowDownIcon(false); + historyBack.setShowFocusedIcon(false); + historyBack.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent event) { getChartOutputTab().zoomOut(); } }); @@ -146,6 +164,7 @@ addMember(datacage); addMember(zoomToMaxExtent); + addMember(historyBack); addMember(zoomOut); addMember(zoombox); addMember(panControl); diff -r 66192d170c79 -r 4782c0ce9cec flys-client/src/main/webapp/images/zoom-back.png Binary file flys-client/src/main/webapp/images/zoom-back.png has changed