Edge scroll, minor refactoring

This commit is contained in:
barsdeveloper
2023-02-08 22:15:37 +01:00
parent cb98b85084
commit 319f5af77f
20 changed files with 175 additions and 60 deletions

View File

@@ -108,10 +108,10 @@ export default class Utility {
*/
static convertLocation(viewportLocation, movementElement, ignoreScale = false) {
const scaleCorrection = ignoreScale ? 1 : 1 / Utility.getScale(movementElement)
const targetOffset = movementElement.getBoundingClientRect()
const bounding = movementElement.getBoundingClientRect()
let location = [
Math.round((viewportLocation[0] - targetOffset.x) * scaleCorrection),
Math.round((viewportLocation[1] - targetOffset.y) * scaleCorrection)
Math.round((viewportLocation[0] - bounding.x) * scaleCorrection),
Math.round((viewportLocation[1] - bounding.y) * scaleCorrection)
]
return location
}