mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-22 14:54:43 +08:00
Naming
This commit is contained in:
31
js/input/MouseWheel.js
Normal file
31
js/input/MouseWheel.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import Pointing from "./Pointing"
|
||||
|
||||
export default class MouseWheel extends Pointing {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLElement} target
|
||||
* @param {import("../UEBlueprint").EBlueprint} blueprint
|
||||
* @param {Object} options
|
||||
*/
|
||||
constructor(target, blueprint, options) {
|
||||
super(target, blueprint, options)
|
||||
this.looseTarget = options?.looseTarget ?? true
|
||||
let self = this
|
||||
|
||||
this.mouseWheelHandler = function (e) {
|
||||
e.preventDefault()
|
||||
const location = self.getLocation(e)
|
||||
self.wheel(Math.sign(e.deltaY), location)
|
||||
}
|
||||
|
||||
this.movementSpace.addEventListener('wheel', this.mouseWheelHandler, false)
|
||||
// Prevent movement space from being scrolled
|
||||
this.movementSpace.parentElement?.addEventListener('wheel', e => e.preventDefault())
|
||||
}
|
||||
|
||||
/* Subclasses will override the following method */
|
||||
wheel(variation, location) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user