diff --git a/Canvas.js b/Canvas.js index 0de5abe37..c4e8eb2b6 100644 --- a/Canvas.js +++ b/Canvas.js @@ -834,8 +834,6 @@ function newCanvas () { function onMouseWheel (event) { try { - if (IS_MAC) { event.delta = event.delta / MAC_AMOUNT_FACTOR } - thisObject.mouse.event = event thisObject.mouse.position.x = event.pageX thisObject.mouse.position.y = event.pageY - CURRENT_TOP_MARGIN @@ -844,6 +842,9 @@ function newCanvas () { // cross-browser wheel delta var event = window.event || event // old IE support event.delta = Math.max(-1, Math.min(1, event.wheelDelta || -event.detail)) + if (IS_MAC) { + event.delta = event.delta / MAC_AMOUNT_FACTOR + } /* We try first with panels. */ diff --git a/ChartingSpace/Viewport.js b/ChartingSpace/Viewport.js index 4a432ac99..84104e0ee 100644 --- a/ChartingSpace/Viewport.js +++ b/ChartingSpace/Viewport.js @@ -204,8 +204,6 @@ function newViewport () { if (event.buttons === 4) { morePower = 2 } // Mouse wheel pressed. /* We adjust the sensitivity for Mac Users */ - if (IS_MAC) { amount = amount / MAC_AMOUNT_FACTOR } - if (thisObject.zoomTargetLevel > 10) { amount = amount * 2 } diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 15f4dd0f3..cccc6d18b 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -45,6 +45,7 @@ function newFloatingObject () { initializeRadius: initializeRadius, initializeImageSize: initializeImageSize, initializeFontSize: initializeFontSize, + initializeHierarchyRing: initializeHierarchyRing, initializeCurrentPosition: initializeCurrentPosition, radomizeCurrentSpeed: radomizeCurrentSpeed, drawBackground: drawBackground, @@ -366,6 +367,14 @@ function newFloatingObject () { } } + if (Math.abs(thisObject.currentHierarchyRing - thisObject.targetHierarchyRing) >= 10) { + if (thisObject.currentHierarchyRing < thisObject.targetHierarchyRing) { + thisObject.currentHierarchyRing = thisObject.currentHierarchyRing + 10 + } else { + thisObject.currentHierarchyRing = thisObject.currentHierarchyRing - 10 + } + } + /* Floating object position in screen coordinates */ thisObject.payload.position.x = thisObject.container.frame.position.x @@ -377,6 +386,7 @@ function newFloatingObject () { thisObject.targetRadius = thisObject.rawRadius * 6.0 thisObject.targetImageSize = thisObject.rawImageSize * 2.0 thisObject.targetFontSize = thisObject.rawFontSize * 2.0 + thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 8.0 thisObject.payload.uiObject.container.eventHandler.raiseEvent('onFocus', point) @@ -409,6 +419,7 @@ function newFloatingObject () { thisObject.targetRadius = thisObject.rawRadius * 1 thisObject.targetImageSize = thisObject.rawImageSize * 1 thisObject.targetFontSize = thisObject.rawFontSize * 1 + thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 1 thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus') @@ -473,7 +484,7 @@ function newFloatingObject () { } function initializeImageSize (suggestedValue) { - var size = suggestedValue + let size = suggestedValue if (size < 2) { size = 2 } @@ -484,7 +495,7 @@ function newFloatingObject () { } function initializeFontSize (suggestedValue) { - var size = suggestedValue + let size = suggestedValue if (size < 3) { size = 3 } @@ -494,6 +505,17 @@ function newFloatingObject () { thisObject.currentFontSize = size / 3 } + function initializeHierarchyRing (suggestedValue) { + let radius = suggestedValue + if (radius < 3) { + radius = 3 + } + + thisObject.rawHierarchyRing = radius + thisObject.targetHierarchyRing = radius + thisObject.currentHierarchyRing = radius + } + function initializeCurrentPosition (arroundPoint) { let position = {} diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 1d94d1b7f..fd700603e 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1239,7 +1239,7 @@ function newUiObject () { let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) if (nodeDefinition !== undefined) { if (nodeDefinition.isHierarchyHead === true) { - VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + VISIBLE_RADIUS = thisObject.payload.floatingObject.currentHierarchyRing * 2.8 let OPACITY = 1 browserCanvasContext.beginPath() diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 881389769..275ae7afe 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -373,6 +373,7 @@ function newUiObjectConstructor () { const INITIAL_FONT_SIZE = 12 * 1.5 const INITIAL_RADIOUS = 45 * 1.5 const INITIAL_IMAGE_SIZE = 80 * 1.2 + const INITIAL_HIERARCHY_RING = 20 switch (payload.node.type) { case 'Workspace': { @@ -420,6 +421,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(500) floatingObject.initializeRadius(INITIAL_RADIOUS) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) @@ -431,6 +433,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(600) floatingObject.initializeRadius(INITIAL_RADIOUS) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) @@ -446,6 +449,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(300) floatingObject.initializeRadius(INITIAL_RADIOUS - 5) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE - 10) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) @@ -461,6 +465,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(150) floatingObject.initializeRadius(INITIAL_RADIOUS - 10) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE - 20) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) @@ -476,6 +481,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(75) floatingObject.initializeRadius(INITIAL_RADIOUS - 15) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE - 30) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) @@ -491,6 +497,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(50) floatingObject.initializeRadius(INITIAL_RADIOUS - 20) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE - 40) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) @@ -502,6 +509,7 @@ function newUiObjectConstructor () { floatingObject.initializeMass(25) floatingObject.initializeRadius(INITIAL_RADIOUS - 25) + floatingObject.initializeHierarchyRing(INITIAL_HIERARCHY_RING) floatingObject.initializeImageSize(INITIAL_IMAGE_SIZE - 50) floatingObject.initializeFontSize(INITIAL_FONT_SIZE) diff --git a/Scales/RateScale.js b/Scales/RateScale.js index a532aea1f..4fafa81f9 100644 --- a/Scales/RateScale.js +++ b/Scales/RateScale.js @@ -56,6 +56,10 @@ function newRateScale () { let scaleDisplayTimer = 0 let autoScaleButton + + let wheelDeltaDirection + let wheelDeltaCounter = 0 + return thisObject function finalize () { @@ -134,6 +138,42 @@ function newRateScale () { } function onMouseWheel (event) { + if (IS_MAC) { + let sensitivity + if (event.wheelDelta < 0) { + if (event.shiftKey === true) { + sensitivity = 20 + } else { + sensitivity = 5 + } + if (wheelDeltaDirection === -1) { + wheelDeltaCounter++ + if (wheelDeltaCounter < sensitivity) { + return + } else { + wheelDeltaCounter = 0 + } + } else { + wheelDeltaCounter = 0 + wheelDeltaDirection = -1 + return + } + } else { + if (wheelDeltaDirection === 1) { + wheelDeltaCounter++ + if (wheelDeltaCounter < sensitivity) { + return + } else { + wheelDeltaCounter = 0 + } + } else { + wheelDeltaCounter = 0 + wheelDeltaDirection = 1 + return + } + } + } + if (event.shiftKey === true) { autoScaleButton.container.eventHandler.raiseEvent('onMouseWheel', event) return diff --git a/Scales/TimeFrameScale.js b/Scales/TimeFrameScale.js index 856a1e15f..9c718e28e 100644 --- a/Scales/TimeFrameScale.js +++ b/Scales/TimeFrameScale.js @@ -45,6 +45,10 @@ function newTimeFrameScale () { } } setupContainer() + + let wheelDeltaDirection + let wheelDeltaCounter = 0 + return thisObject function setupContainer () { @@ -249,7 +253,43 @@ function newTimeFrameScale () { } function onMouseWheel (event) { - delta = event.wheelDelta + if (IS_MAC) { + let sensitivity + if (event.wheelDelta < 0) { + if (event.shiftKey === true) { + sensitivity = 20 + } else { + sensitivity = 5 + } + if (wheelDeltaDirection === -1) { + wheelDeltaCounter++ + if (wheelDeltaCounter < sensitivity) { + return + } else { + wheelDeltaCounter = 0 + } + } else { + wheelDeltaCounter = 0 + wheelDeltaDirection = -1 + return + } + } else { + if (wheelDeltaDirection === 1) { + wheelDeltaCounter++ + if (wheelDeltaCounter < sensitivity) { + return + } else { + wheelDeltaCounter = 0 + } + } else { + wheelDeltaCounter = 0 + wheelDeltaDirection = 1 + return + } + } + } + + let delta = event.wheelDelta if (delta < 0) { timeFrameIndex-- if (timeFrameIndex < 0) { diff --git a/Scales/TimeScale.js b/Scales/TimeScale.js index 62a1220b3..c51840b55 100644 --- a/Scales/TimeScale.js +++ b/Scales/TimeScale.js @@ -48,6 +48,9 @@ function newTimeScale () { } } + let wheelDeltaDirection + let wheelDeltaCounter = 0 + return thisObject function finalize () { @@ -116,6 +119,42 @@ function newTimeScale () { } function onMouseWheel (event) { + if (IS_MAC) { + let sensitivity + if (event.wheelDelta < 0) { + if (event.shiftKey === true) { + sensitivity = 20 + } else { + sensitivity = 5 + } + if (wheelDeltaDirection === -1) { + wheelDeltaCounter++ + if (wheelDeltaCounter < sensitivity) { + return + } else { + wheelDeltaCounter = 0 + } + } else { + wheelDeltaCounter = 0 + wheelDeltaDirection = -1 + return + } + } else { + if (wheelDeltaDirection === 1) { + wheelDeltaCounter++ + if (wheelDeltaCounter < sensitivity) { + return + } else { + wheelDeltaCounter = 0 + } + } else { + wheelDeltaCounter = 0 + wheelDeltaDirection = 1 + return + } + } + } + if (event.shiftKey === true) { autoScaleButton.container.eventHandler.raiseEvent('onMouseWheel', event) return