diff --git a/FAQ.md b/FAQ.md index 3836517..e2c9677 100644 --- a/FAQ.md +++ b/FAQ.md @@ -5,6 +5,7 @@ * [OpenSeadragon doesn't work well on mobile devices in portrait orientation](#mobile-portrait) * [OpenSeadragon isn't working right in my Vue application](#vue) * [Can I use TIFF files in OpenSeadragon?](#tiff) +* [How can I disable the default key bindings?](#keybindings) ## Questions and Answers @@ -37,4 +38,16 @@ As of OpenSeadragon release 4.0.0, the technique that `Vue2` uses to observe cha OpenSeadragon doesn't support TIFF files directly, but you have a number of options. You could: * Convert your TIFF file to one of the formats OpenSeadragon supports, like DZI. There are lots of tools for that at https://openseadragon.github.io/examples/creating-zooming-images/. * Use a server that converts the TIFF file on the fly, like https://iipimage.sourceforge.io/. -* Use the https://github.com/pearcetm/GeoTIFFTileSource plugin. \ No newline at end of file +* Use the https://github.com/pearcetm/GeoTIFFTileSource plugin. + +### How can I disable the default key bindings? + +The following code snippet will disable all of the default key bindings. You can edit the list of keys to be more specific depending on your application. +``` +// suppress default OSD keydown handling for a subset of keys +viewer.addHandler('canvas-key',event=>{ + if(['q', 'w', 'e', 'r', 'a', 's', 'd', 'f'].includes(event.originalEvent.key)){ + event.preventDefaultAction = true; + } +}); +``` \ No newline at end of file