mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-21 14:24:47 +08:00
Various styling fixes
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import Configuration from "../../Configuration.js"
|
||||
import IMouseWheel from "./IMouseWheel.js"
|
||||
|
||||
export default class Zoom extends IMouseWheel {
|
||||
|
||||
#accumulatedVariation = 0
|
||||
|
||||
#enableZoonIn = false
|
||||
get enableZoonIn() {
|
||||
return this.#enableZoonIn
|
||||
@@ -14,12 +17,18 @@ export default class Zoom extends IMouseWheel {
|
||||
}
|
||||
|
||||
wheel(variation, location) {
|
||||
this.#accumulatedVariation += -variation
|
||||
variation = this.#accumulatedVariation
|
||||
if (Math.abs(this.#accumulatedVariation) < Configuration.mouseWheelZoomThreshold) {
|
||||
return
|
||||
} else {
|
||||
this.#accumulatedVariation = 0
|
||||
}
|
||||
let zoomLevel = this.blueprint.getZoom()
|
||||
variation = -variation
|
||||
if (!this.enableZoonIn && zoomLevel == 0 && variation > 0) {
|
||||
return
|
||||
}
|
||||
zoomLevel += variation
|
||||
zoomLevel += Math.sign(variation)
|
||||
this.blueprint.setZoom(zoomLevel, location)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user