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
This commit is contained in:
barsdeveloper
2023-08-11 02:48:50 +02:00
committed by GitHub
parent 2284789e6e
commit ed43ee3edd
29 changed files with 652 additions and 485 deletions

View File

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