Files
ueblueprint/js/input/mouse/Zoom.js
barsdeveloper ed43ee3edd Input refactoring (#12)
* Fix folder name typo

* Smaller fixes

* Shortcut rename to Shortcuts

* Fix quoted attributes in UE 5.3

* remove KeyboardShortcutAction

* Remove more trivial classes

* Rename IKeyboardShortcut

* Node delete shortcut
2023-08-11 02:48:50 +02:00

33 lines
955 B
JavaScript
Executable File

import Configuration from "../../Configuration.js"
import MouseWheel from "./MouseWheel.js"
export default class Zoom extends MouseWheel {
#accumulatedVariation = 0
#enableZoonIn = false
get enableZoonIn() {
return this.#enableZoonIn
}
set enableZoonIn(value) {
if (value == this.#enableZoonIn) {
return
}
this.#enableZoonIn = value
}
wheel() {
this.#accumulatedVariation += -this.variation
if (Math.abs(this.#accumulatedVariation) < Configuration.mouseWheelZoomThreshold) {
return
}
let zoomLevel = this.blueprint.getZoom()
if (!this.enableZoonIn && zoomLevel == 0 && this.#accumulatedVariation > 0) {
return
}
zoomLevel += Math.sign(this.#accumulatedVariation)
this.blueprint.setZoom(zoomLevel, this.location)
this.#accumulatedVariation = 0
}
}