I have a site that has some very specific scrolling behaviour and it's own navigation mode using arrow keys. For the sake of this question, lets just say the user can press the arrow keys (or scroll) in order to navigate the page.
I read this question and it's answer (Mouse and key events in Forge Viewer), to disable key press events by adding a custom tool with high priority, but this would disable all keypresses (and the link to the Forge Blog in the answer is broken...so maybe it's outdated?)
Is there a list of configured key events somewhere in the Forge API documentation? I have looked all around but have not managed to find it. It would be very helpful to know which keypresses are configured to be able to choose which ones to disable in the tool.
Thanks!
Unfortunately there's no documentation available.
The easiest way to intercept key presses would be to piggyback the corresponding callbacks in VIEWER.impl.controls
(by for example conditionally allow certain keys to be handled by Viewer and intercept the rest for your own workflows), say:
const keyup = NOP_VIEWER.impl.controls.handleKeyUp.bind(NOP_VIEWER.impl.controls)
NOP_VIEWER.impl.controls.handleKeyUp=function(e){
//your code goes here
keyup(e)
}
// KeyboardEvent {isTrusted: true, key: "ArrowUp", code: "ArrowUp", location: 0, ctrlKey: false, …}
and the link to the Forge Blog in the answer is broken...so maybe it's outdated?
Nope the tool interface described in that article is still valid (as of the latest Viewer v7.15) - it's just we are having an issue with our blog system and as of a result some of the older blogs have become unavailable.