Link implementation wip

This commit is contained in:
barsdeveloper
2022-01-18 21:21:45 +01:00
parent ce5b184b3d
commit e90277826d
19 changed files with 580 additions and 454 deletions

View File

@@ -10,6 +10,16 @@ export default class Utility {
return getComputedStyle(element).getPropertyValue("--ueb-scale")
}
static convertLocation(viewportLocation, movementElement) {
const scaleCorrection = 1 / Utility.getScale(movementElement)
const targetOffset = movementElement.getBoundingClientRect()
let location = [
Math.round((viewportLocation[0] - targetOffset.x) * scaleCorrection),
Math.round((viewportLocation[1] - targetOffset.y) * scaleCorrection)
]
return location
}
/**
* Sets a value in an object
* @param {String[]} keys The chained keys to access from object in order to set the value