zoom at center

This commit is contained in:
Luis Fernando Molina committed 2020-03-07 17:56:13 +01:00
1 parent 8c7cdce253
commit 82985b04e4
1 file changed
+8
+8
View File
@@ -30,6 +30,7 @@ function newViewport () {
mousePosition: undefined,
margins: MARGINS,
payload: undefined,
zoomAtCenter: zoomAtCenter,
changeZoom: changeZoom,
onMouseWheel: onMouseWheel,
transformThisPoint: transformThisPoint,
@@ -62,6 +63,8 @@ function newViewport () {
thisObject.zoomTargetLevel = MIN_ZOOM_LEVEL
INITIAL_TIME_PERIOD = recalculatePeriod(thisObject.zoomLevel)
let overrideMousePositionCounter = 0
return thisObject
function finalize () {
@@ -263,6 +266,11 @@ function newViewport () {
thisObject.eventHandler.raiseEvent('Position Changed', event)
}
function zoomAtCenter (level) {
thisObject.zoomTargetLevel = level
overrideMousePositionCounter = 10
}
function changeZoom (oldLevel, newLevel) {
if (thisObject.visible === false) { return }
let oldMouse = unTransformThisPoint(thisObject.mousePosition, oldLevel)