]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
toolkit: fix #1516: mouse-scrolling of overflowhandlers in firefox
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Dec 2017 07:16:14 +0000 (08:16 +0100)
committerDominik Csapak <d.csapak@proxmox.com>
Thu, 11 Jan 2018 13:45:48 +0000 (14:45 +0100)
this is a workaround for scrolling in toolbars, etc. in firefox with
the mouse.
while the result is not very "pretty", it maintains the old behaviour
for all other browsers and makes it work in firefox

we may drop this when we update to a new extjs release

commit 484bf3f29e58d0f96c65e6dca6b5dd95eaea180c from pve-manager

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Toolkit.js

index 9e3735284df8ed090b44bae80536ed9c834645fc..e4e9dca6230e8e69084f77b6c3df00d6819e455e 100644 (file)
@@ -304,6 +304,31 @@ Ext.define('Proxmox.form.field.Text', {
     },
 });
 
+// this should be fixed with ExtJS 6.0.2
+// make mousescrolling work in firefox in the containers overflowhandler
+Ext.define(null, {
+    override: 'Ext.layout.container.boxOverflow.Scroller',
+
+    createWheelListener: function() {
+       var me = this;
+       if (Ext.isFirefox) {
+           me.wheelListener = me.layout.innerCt.on('wheel', me.onMouseWheelFirefox, me, {destroyable: true});
+       } else {
+           me.wheelListener = me.layout.innerCt.on('mousewheel', me.onMouseWheel, me, {destroyable: true});
+       }
+    },
+
+    // special wheel handler for firefox. differs from the default onMouseWheel
+    // handler by using deltaY instead of wheelDeltaY and no normalizing,
+    // because it is already
+    onMouseWheelFirefox: function(e) {
+       e.stopEvent();
+       var delta = e.browserEvent.deltaY || 0;
+       this.scrollBy(delta * this.wheelIncrement, false);
+    }
+
+});
+
 // force alert boxes to be rendered with an Error Icon
 // since Ext.Msg is an object and not a prototype, we need to override it
 // after the framework has been initiated