Page 1 of 1

Wheel mouse emulation for Subfile

Posted: 28 May 2018, 18:01
by Fairdinkum
Hi,

A mouse scroll event can be detected by easy customization/scripting.
Copy and paste the following codes into onArrive and onLeave properties.

(onArrive)
----------------------------------------------------------------------------
/*
* Firefox
*/
if(window.addEventListener){
window.addEventListener('DOMMouseScroll', function(e){
console.log("addEventListener (Firefox)");
console.log("[Firefox] "+e.detail);
if ( e.detail > 0 )
SENDKEY("PageUp");
else
SENDKEY("PageDown");
}, false);
}
/*
* Chrome/IE/Edge/Safari
*/
window.onmousewheel = function(e){
console.log("onmousewheel enabled (Chrome)");
console.log("[Chrome] "+e.wheelDelta);
if ( e.wheelDelta < 0 )
SENDKEY("PageDown");
else
SENDKEY("PageUp");
};
----------------------------------------------------------------------------

(onLeave)
----------------------------------------------------------------------------
/*
* Firefox
*/
if(window.removeEventListener){
window.addEventListener('DOMMouseScroll', function(e){
console.log("removeEventListener (Firefox)");
}, false);
}
/*
* Chrome/IE/Edge/Safari
*/
window.onmousewheel = function(e){
console.log("onmousewheel disabled (Chrome)");
};
----------------------------------------------------------------------------


The result will be:
https://drive.google.com/file/d/0BwvNUe ... Q4SWM/view

HTH.

Best Regards,
Hidekazu Tanaka

Re: Wheel mouse emulation for Subfile

Posted: 03 May 2019, 01:37
by safalpiya
Hi Hidekazu Tanaka,

Can we make this a global setting so that we don't have to add onArrive and onLeave on each screen that has subfile page up and down?

Regards,
Safal Piya

Re: Wheel mouse emulation for Subfile

Posted: 20 May 2019, 16:00
by Fairdinkum
Hi Safal,

Sorry for delay reply. You might have already tried, but it can be implemented by:
- Coding in onApplicationStart instead of onArrive
- Coding in onApplicationEnd instead of onLeave

In this case, wheel scrolling will be ALWAYS emulated as PageUp/Down on all the screens.

Hope this helps.

Best Regards,
Hidekazu Tanaka

Re: Wheel mouse emulation for Subfile

Posted: 01 Apr 2020, 00:50
by Joerg Hamacher
Hi Hidekazu,
this is a great script.
My problem with it is that whenputting it into "onApplicationStart" it is active in the complete editor session, too.
Is there a way to re-define the script so it has only effect in the screen itself and not in the editor part?

Best regards and many thanks,
Joerg

Re: Wheel mouse emulation for Subfile

Posted: 01 Apr 2020, 10:10
by Fairdinkum
Hi Joerg,
Thanks for your kindly comment! It will probably be solved by my first post. It said coding into onArrive/onLeave properties. I'm not 100% sure what "it is active in the complete editor session" means, though, it would not happen if the screen is "locked".
HTH :)

Best Regards,
Hidekazu Tanaka