[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - filter/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 26 13:46:23 UTC 2019
filter/source/svg/presentation_engine.js | 46 ++++++++++++++-----------------
1 file changed, 22 insertions(+), 24 deletions(-)
New commits:
commit fa183dcb5c5852df6acb51196e5837780235af9d
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Oct 23 17:47:58 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Nov 26 14:45:28 2019 +0100
tdf#127939: Make slideshow touch input work properly again on iOS 13
For some reason, navigator.userAgent in WebKit on iOS 13 claims it to
be a Macintosh, so our old code to recognise iOS did not work any
longer. Also the Hammer.js included in this file looked at
navigator.userAgent and its decision what to do based on that did not
work properly either.
Simplify our code by handling swipe gestures all the time, even when
such won't be generated (on mouse-only devices).
Also, Hammer.JS was too eager to think it detected a pointer-only
device based on the presense of window.PointerEvent. That sems to be
present now in iOS 13. Let's not blindly think that means it is a
pointer-only device. If the device supports touch events, don't bother
with PointerEvents.
Change-Id: I57d972415798967e871c6e262f16043561ed6af5
Reviewed-on: https://gerrit.libreoffice.org/81404
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Tested-by: Tor Lillqvist <tml at collabora.com>
(cherry picked from commit 8f78d6a0d1b4d8d2e21aad9e90510fe6be4df5bb)
Reviewed-on: https://gerrit.libreoffice.org/83731
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index bb1070a4f39d..95493607c41c 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -494,7 +494,7 @@ function createInputInstance(manager) {
if (inputClass) {
Type = inputClass;
- } else if (SUPPORT_POINTER_EVENTS) {
+ } else if (!SUPPORT_TOUCH && SUPPORT_POINTER_EVENTS) {
Type = PointerEventInput;
} else if (SUPPORT_ONLY_TOUCH) {
Type = TouchInput;
@@ -823,6 +823,7 @@ inherit(MouseInput, Input, {
* @param {Object} ev
*/
handler: function MEhandler(ev) {
+ // console.log('==> MouseInput handler');
var eventType = MOUSE_INPUT_MAP[ev.type];
// on start we want to have the left mouse button down
@@ -897,6 +898,7 @@ inherit(PointerEventInput, Input, {
* @param {Object} ev
*/
handler: function PEhandler(ev) {
+ // console.log('==> PointerEventInput handler');
var store = this.store;
var removePointer = false;
@@ -966,6 +968,7 @@ function SingleTouchInput() {
inherit(SingleTouchInput, Input, {
handler: function TEhandler(ev) {
+ // console.log('==> SingleTouchInput handler');
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
// should we handle the touch events?
@@ -1033,6 +1036,7 @@ function TouchInput() {
inherit(TouchInput, Input, {
handler: function MTEhandler(ev) {
+ // console.log('==> TouchInput handler');
var type = TOUCH_INPUT_MAP[ev.type];
var touches = getTouches.call(this, ev, type);
if (!touches) {
@@ -1141,6 +1145,7 @@ inherit(TouchMouseInput, Input, {
* @param {Object} inputData
*/
handler: function TMEhandler(manager, inputEvent, inputData) {
+ // console.log('==> TouchMouseInput handler');
var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
@@ -6480,26 +6485,22 @@ function init()
theSlideIndexPage = new SlideIndexPage();
aSlideShow.displaySlide( theMetaDoc.nStartSlideNumber, false );
- // In the iOS app, allow slide switching with swipe gestures left
+ // Allow slide switching with swipe gestures left
// and right. Swiping up or down will exit the slideshow.
- var ua = navigator.userAgent;
- if (ua.indexOf(' AppleWebKit/') !== -1 &&
- ua.indexOf(' Mobile/') !== -1) {
- var hammer = new Hammer(ROOT_NODE);
- hammer.on('swipeleft', function() {
- switchSlide(1, false);
- });
- hammer.on('swiperight', function() {
- switchSlide(-1, false);
- });
- hammer.get('swipe').set({ direction: Hammer.DIRECTION_ALL });
- hammer.on('swipeup', function() {
- aSlideShow.exitSlideShowInApp();
- });
- hammer.on('swipedown', function() {
- aSlideShow.exitSlideShowInApp();
- });
- }
+ var hammer = new Hammer(ROOT_NODE);
+ hammer.on('swipeleft', function() {
+ switchSlide(1, false);
+ });
+ hammer.on('swiperight', function() {
+ switchSlide(-1, false);
+ });
+ hammer.get('swipe').set({ direction: Hammer.DIRECTION_ALL });
+ hammer.on('swipeup', function() {
+ aSlideShow.exitSlideShowInApp();
+ });
+ hammer.on('swipedown', function() {
+ aSlideShow.exitSlideShowInApp();
+ });
}
function presentationEngineStop()
@@ -18414,10 +18415,7 @@ SlideShow.prototype.rewindAllEffects = function()
SlideShow.prototype.exitSlideShowInApp = function()
{
- var ua = navigator.userAgent;
- if (ua.indexOf(' AppleWebKit/') !== -1 &&
- ua.indexOf(' Mobile/') !== -1 &&
- window.webkit !== undefined &&
+ if (window.webkit !== undefined &&
window.webkit.messageHandlers !== undefined &&
window.webkit.messageHandlers.lool !== undefined)
window.webkit.messageHandlers.lool.postMessage('EXITSLIDESHOW', '*');
More information about the Libreoffice-commits
mailing list