fizing zoom wip

This commit is contained in:
barsdeveloper
2021-08-26 23:43:43 +02:00
parent 4017d6ab64
commit 3f176ea4a4
3 changed files with 42 additions and 10 deletions

View File

@@ -240,10 +240,19 @@ export default class UEBlueprint extends HTMLElement {
return
}
let initialScale = this.getScale()
this.classList.add(`ueb-zoom-${zoom}`)
this.classList.remove(`ueb-zoom-${this.zoom}`)
this.classList.add(`ueb-zoom-${zoom}`)
this.zoom = zoom
if (center) {
let point = document.createElement('div');
point.style.width = '2px'
point.style.height = '2px'
point.style.background = 'red'
point.style.position = 'absolute'
document.querySelector('.ueb-grid').appendChild(point)
let relativeScale = this.getScale() / initialScale
let newCenter = [
relativeScale * center[0],
@@ -253,6 +262,8 @@ export default class UEBlueprint extends HTMLElement {
(newCenter[0] - center[0]) * initialScale,
(newCenter[1] - center[1]) * initialScale
])
point.style.left = `${center[0]}px`
point.style.top = `${center[1]}px`
}
}