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 }