mouse position centralized in canvas

This commit is contained in:
Luis Fernando Molina committed 2020-04-08 10:46:56 +02:00
1 parent 3c9d5c8c06
commit 33db177388
2 files changed
+3 -30

No files matched your search

+1 -14
View File
@@ -38,12 +38,6 @@ function newTimeFrameScale () {
let limitingContainer
let mouse = {
position: {
x: 0,
y: 0
}
}
setupContainer()
let wheelDeltaDirection
@@ -76,7 +70,6 @@ function newTimeFrameScale () {
thisObject.payload = undefined
limitingContainer = undefined
mouse = undefined
}
function initialize (pLimitingContainer) {
@@ -103,12 +96,6 @@ function newTimeFrameScale () {
turnOnCounter = 0
}
}
mouse = {
position: {
x: event.x,
y: event.y
}
}
}
function onMouseOver (event) {
@@ -201,7 +188,7 @@ function newTimeFrameScale () {
}
timePoint = transformThisPoint(timePoint, limitingContainer.frame.container)
timePoint.x = mouse.position.x - thisObject.container.frame.width / 2
timePoint.x = canvas.mouse.position.x - thisObject.container.frame.width / 2
/* Checking against the container limits. */
if (timePoint.x < upCorner.x) { timePoint.x = upCorner.x }
+2 -16
View File
@@ -42,13 +42,6 @@ function newTimeScale () {
let coordinateSystem
let limitingContainer
let mouse = {
position: {
x: 0,
y: 0
}
}
let wheelDeltaDirection
let wheelDeltaCounter = 0
@@ -67,7 +60,6 @@ function newTimeScale () {
coordinateSystem = undefined
limitingContainer = undefined
mouse = undefined
autoScaleButton.finalize()
autoScaleButton = undefined
@@ -101,12 +93,6 @@ function newTimeScale () {
turnOnCounter = 0
}
}
mouse = {
position: {
x: event.x,
y: event.y
}
}
}
function onMouseOver (event) {
@@ -253,7 +239,7 @@ function newTimeScale () {
/* Mouse Position Date Calculation */
let timePoint = {
x: mouse.position.x,
x: canvas.mouse.position.x,
y: 0
}
@@ -268,7 +254,7 @@ function newTimeScale () {
}
timePoint = transformThisPoint(timePoint, limitingContainer.frame.container)
timePoint.x = mouse.position.x - thisObject.container.frame.width / 2
timePoint.x = canvas.mouse.position.x - thisObject.container.frame.width / 2
/* Checking against the container limits. */
if (timePoint.x < upCorner.x) { timePoint.x = upCorner.x }