From 8c4fbe6609a198171bb249eb0595ecd379c1745b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 28 Aug 2019 14:46:07 +0200 Subject: [PATCH] Fix zoom for mac users --- Animation.js | 9 +++++++++ ChartsSpace/ViewPort.js | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/Animation.js b/Animation.js index 95bf8a85d..c5a53041d 100644 --- a/Animation.js +++ b/Animation.js @@ -79,7 +79,16 @@ function newAnimation () { /* We request the next frame to be drawn, and stablishing a loop */ + /* Use this code for full animation speed. */ animationLoopHandle = window.requestAnimationFrame(animationLoop) + + /* Use this code for max 10 frames per second animation speed, if the app is consumming too much of your CPU. */ + /* + setTimeout(nextLoop, 100) + function nextLoop () { + animationLoopHandle = window.requestAnimationFrame(animationLoop) + } + */ } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] animationLoop -> err = ' + err.stack) } } diff --git a/ChartsSpace/ViewPort.js b/ChartsSpace/ViewPort.js index 358f3a1e6..40f5154f9 100644 --- a/ChartsSpace/ViewPort.js +++ b/ChartsSpace/ViewPort.js @@ -204,6 +204,10 @@ function newViewPort () { function applyZoom (amount) { // console.log("applyZoom amount: " + amount); + /* We adjust the sensitivity for Mac Users */ + let isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0 + if (isMac) { amount = amount / 5 } + if (amount > 0) { if (thisObject.zoomTargetLevel > -5) { amount = amount * 2