Corrected preventDefault with mousewheel in PixiJS List.

This commit is contained in:
Sebastian Kupke 2019-03-29 15:01:21 +01:00
parent f84d554a69
commit 3ca25b3e93
2 changed files with 2 additions and 2 deletions

2
dist/iwmlib.pixi.js vendored
View File

@ -13758,11 +13758,11 @@
if (this.opts.app) { if (this.opts.app) {
const app = this.opts.app; const app = this.opts.app;
app.view.addEventListener('mousewheel', event => { app.view.addEventListener('mousewheel', event => {
event.preventDefault();
const bounds = this.mask ? this.mask.getBounds() : this.getBounds(); const bounds = this.mask ? this.mask.getBounds() : this.getBounds();
const x = event.clientX - app.view.getBoundingClientRect().left; const x = event.clientX - app.view.getBoundingClientRect().left;
const y = event.clientY - app.view.getBoundingClientRect().top; const y = event.clientY - app.view.getBoundingClientRect().top;
if (bounds.contains(x, y)) { if (bounds.contains(x, y)) {
event.preventDefault();
this.emit('scroll', event); this.emit('scroll', event);
} }
}); });

View File

@ -107,11 +107,11 @@ export default class List extends PIXI.Container {
if (this.opts.app) { if (this.opts.app) {
const app = this.opts.app const app = this.opts.app
app.view.addEventListener('mousewheel', event => { app.view.addEventListener('mousewheel', event => {
event.preventDefault()
const bounds = this.mask ? this.mask.getBounds() : this.getBounds() const bounds = this.mask ? this.mask.getBounds() : this.getBounds()
const x = event.clientX - app.view.getBoundingClientRect().left const x = event.clientX - app.view.getBoundingClientRect().left
const y = event.clientY - app.view.getBoundingClientRect().top const y = event.clientY - app.view.getBoundingClientRect().top
if (bounds.contains(x, y)) { if (bounds.contains(x, y)) {
event.preventDefault()
this.emit('scroll', event) this.emit('scroll', event)
} }
}) })