From 1d83a7809348dd9129fba18cc81f97401d03d77a Mon Sep 17 00:00:00 2001 From: Ozcan Esen Date: Mon, 28 Dec 2015 23:42:35 +0200 Subject: [PATCH] loleaflet: change slides with pgup/pgdown in presentation Change-Id: I83a5a51974b6aaf986e6583318f37ecedd5ee8ff Reviewed-on: https://gerrit.libreoffice.org/20994 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian --- loleaflet/src/map/handler/Map.Keyboard.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index 2ce5bf94e..6df4b4c5b 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -139,6 +139,11 @@ L.Map.Keyboard = L.Handler.extend({ 46 : true // delete }, + keyCodes: { + pageUp: 33, + pageDown: 34 + }, + navigationKeyCodes: { left: [37], right: [39], @@ -234,6 +239,22 @@ L.Map.Keyboard = L.Handler.extend({ } } + // Change slides with PgUp/PgDown in Presentation + if (this._map.getDocType() === 'presentation' && !this.modifier && e.type === 'keyup') { + var _keyCode = e.originalEvent.keyCode; + if (_keyCode === this.keyCodes.pageUp || _keyCode === this.keyCodes.pageDown) { + e.originalEvent.preventDefault(); + e.originalEvent.stopPropagation(); + + if (_keyCode === this.keyCodes.pageUp) { + this._map.setPart('prev'); + } + else if (_keyCode === this.keyCodes.pageDown) { + this._map.setPart('next'); + } + } + } + // page up or page down, handled by this.dopagejump // to jump back to the anchor from footnote/endnote by PgUp // or jump back to the main text from header/footer by PgUp or PgDown