Wheel to change repulsion working

This commit is contained in:
Luis Fernando Molina committed 2019-05-04 23:32:43 +02:00
1 parent 26308b3704
commit 3757f8bbac
2 files changed
+25 -7

No files matched your search

+5 -6
View File
@@ -636,7 +636,7 @@ function newCanvas () {
}
event.mousePosition = point
let container
let panelContainer = canvas.panelsSpace.getContainer({ x: point.x, y: point.y })
if (panelContainer !== undefined && panelContainer.isWheelable === true) {
@@ -644,12 +644,12 @@ function newCanvas () {
return false // This instructs the browser not to take the event and scroll the page.
}
/* We try second with floating objects. */
/* We try second with floating objects. */
let floatingObjectIndex = canvas.floatingSpace.floatingLayer.isInside(point.x, point.y)
container = canvas.floatingSpace.getContainer({ x: point.x, y: point.y })
if (floatingObjectIndex > 0) {
canvas.floatingSpace.floatingLayer.changeTargetRepulsion(event.wheelDelta)
if (container !== undefined && container.isWheelable === true) {
container.eventHandler.raiseEvent('Mouse Wheel', event)
return false // This instructs the browser not to take the event and scroll the page.
}
@@ -738,4 +738,3 @@ function newCanvas () {
}
}
}
+20 -1
View File
@@ -12,6 +12,7 @@ function newFloatingSpace () {
profileBalls: undefined,
strategyParts: undefined,
noteSets: undefined,
container: undefined,
makeVisible: makeVisible,
makeInvisible: makeInvisible,
draw: draw,
@@ -21,6 +22,15 @@ function newFloatingSpace () {
finalize: finalize
}
thisObject.container = newContainer()
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isClickeable = false
thisObject.container.isDraggeable = false
thisObject.container.isWheelable = true
thisObject.container.frame.radius = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
let visible = false
return thisObject
@@ -44,6 +54,12 @@ function newFloatingSpace () {
thisObject.strategyParts = newStrategyParts()
thisObject.strategyParts.initialize(thisObject.floatingLayer)
thisObject.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel)
}
function onMouseWheel (event) {
thisObject.floatingLayer.changeTargetRepulsion(event.wheelDelta)
}
function makeVisible () {
@@ -64,6 +80,10 @@ function newFloatingSpace () {
container = thisObject.floatingLayer.getContainer(point)
if (container !== undefined) { return container }
if (visible === true) {
return thisObject.container
}
return container
}
@@ -89,4 +109,3 @@ function newFloatingSpace () {
browserCanvasContext.fill()
}
}