Scales Tunned

This commit is contained in:
Luis Fernando Molina committed 2020-03-10 20:53:35 +01:00
1 parent 27dfde0ad0
commit 153ed44f81
8 files changed
+156 -8

No files matched your search

+3 -2
View File
@@ -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. */
-2
View File
@@ -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
}
+24 -2
View File
@@ -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 = {}
+1 -1
View File
@@ -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()
+8
View File
@@ -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)
+40
View File
@@ -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
+41 -1
View File
@@ -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) {
+39
View File
@@ -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