Remove *unconditional* browser sniffing in web/grab_to_pan.js
According to https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#browser_compatibility, and manual testing in an up-to-date version of Google Chrome, the *unconditional* browser sniffing in `web/grab_to_pan.js` is no longer necessary. In particular, this code is definitely not necessary in MOZCENTRAL-builds.
This commit is contained in:
parent
3c3cbe78ae
commit
34184a89f9
@ -192,15 +192,6 @@ let matchesSelector;
|
|||||||
return matchesSelector; // If found, then truthy, and [].some() ends.
|
return matchesSelector; // If found, then truthy, and [].some() ends.
|
||||||
});
|
});
|
||||||
|
|
||||||
// Browser sniffing because it's impossible to feature-detect
|
|
||||||
// whether event.which for onmousemove is reliable
|
|
||||||
const chrome = window.chrome;
|
|
||||||
const isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
|
|
||||||
// ^ Chrome 15+ ^ Opera 15+
|
|
||||||
const isSafari6plus =
|
|
||||||
/Apple/.test(navigator.vendor) &&
|
|
||||||
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the left mouse is not pressed.
|
* Whether the left mouse is not pressed.
|
||||||
* @param event {MouseEvent}
|
* @param event {MouseEvent}
|
||||||
@ -211,13 +202,26 @@ function isLeftMouseReleased(event) {
|
|||||||
if ("buttons" in event) {
|
if ("buttons" in event) {
|
||||||
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
|
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
|
||||||
// Firefox 15+
|
// Firefox 15+
|
||||||
|
// Chrome 43+
|
||||||
|
// Safari 11.1+
|
||||||
return !(event.buttons & 1);
|
return !(event.buttons & 1);
|
||||||
}
|
}
|
||||||
if (isChrome15OrOpera15plus || isSafari6plus) {
|
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||||
// Chrome 14+
|
// Browser sniffing because it's impossible to feature-detect
|
||||||
// Opera 15+
|
// whether event.which for onmousemove is reliable.
|
||||||
// Safari 6.0+
|
const chrome = window.chrome;
|
||||||
return event.which === 0;
|
const isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
|
||||||
|
// ^ Chrome 15+ ^ Opera 15+
|
||||||
|
const isSafari6plus =
|
||||||
|
/Apple/.test(navigator.vendor) &&
|
||||||
|
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
|
||||||
|
|
||||||
|
if (isChrome15OrOpera15plus || isSafari6plus) {
|
||||||
|
// Chrome 14+
|
||||||
|
// Opera 15+
|
||||||
|
// Safari 6.0+
|
||||||
|
return event.which === 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user