diff --git a/BottomSpace/ChartAspectRatio.js b/BottomSpace/ChartAspectRatio.js index c5e6e7063..bdf41b6eb 100644 --- a/BottomSpace/ChartAspectRatio.js +++ b/BottomSpace/ChartAspectRatio.js @@ -44,7 +44,7 @@ canDrawIcon = true; } - icon.src = "Images/aspect.ratio.Y.png"; + icon.src = "Images/Icons/chart-scale.png"; thisObject.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel); @@ -52,6 +52,8 @@ function onMouseWheel(pDelta) { + if (viewPort.isMinZoom() === false) { return; } // We only make this button to work at the min zoom level. + if (pDelta < 0) { pDelta = -0.1; } else { @@ -100,11 +102,12 @@ thisObject.container.frame.draw(false, false); if (canDrawIcon === false) { return; } + if (viewPort.isMinZoom() === false) { return; } // We only show this button at the min zoom level. let breakpointsHeight = 15; - let imageHeight = 30; - let imageWidth = 30; + let imageHeight = 15; + let imageWidth = 15; let imagePoint = { x: 10, diff --git a/Images/Icons/chart-scale.png b/Images/Icons/chart-scale.png new file mode 100644 index 000000000..bcffba53f Binary files /dev/null and b/Images/Icons/chart-scale.png differ diff --git a/Images/aspect.ratio.Y.png b/Images/aspect.ratio.Y.png deleted file mode 100644 index f5a4ce7d4..000000000 Binary files a/Images/aspect.ratio.Y.png and /dev/null differ diff --git a/ViewPort.js b/ViewPort.js index 53242a218..6213c15b1 100644 --- a/ViewPort.js +++ b/ViewPort.js @@ -8,6 +8,7 @@ function newViewPort() { const BOTTOM_MARGIN = 15 + BOTTOM_SPACE_HEIGHT; const LEFT_MARGIN = 50; const RIGHT_MARGIN = 50; + const MIN_ZOOM_LEVEL = -28.25 let thisObject = { visibleArea: undefined, @@ -17,6 +18,7 @@ function newViewPort() { mousePosition: undefined, newZoomLevel: newZoomLevel, applyZoom: applyZoom, + isMinZoom: isMinZoom, zoomFontSize: zoomFontSize, zoomThisPoint: zoomThisPoint, unzoomThisPoint: unzoomThisPoint, @@ -169,6 +171,13 @@ function newViewPort() { return true; } + function isMinZoom() { + /* returns true is we are currently at the min zoom level. */ + + if (thisObject.zoomTargetLevel === MIN_ZOOM_LEVEL) { return true; } else { return false;} + + } + function applyZoom(amount) { //console.log("applyZoom amount: " + amount); @@ -216,7 +225,7 @@ function newViewPort() { amount = amount / 4; } - if (thisObject.zoomTargetLevel + amount < -28.25) { + if (thisObject.zoomTargetLevel + amount < MIN_ZOOM_LEVEL) { return false; }