Browse Source

Merge pull request #7722 from Rob--W/grab-to-pan-cssom-and-cleanup

Update to latest grab-to-pan version
Jonas Jenwald 9 years ago committed by GitHub
parent
commit
bc3bcebde2
  1. 15
      web/grab_to_pan.js

15
web/grab_to_pan.js

@ -142,7 +142,6 @@
this.element.addEventListener('scroll', this._endPan, true); this.element.addEventListener('scroll', this._endPan, true);
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);
var focusedElement = document.activeElement; var focusedElement = document.activeElement;
if (focusedElement && !focusedElement.contains(event.target)) { if (focusedElement && !focusedElement.contains(event.target)) {
@ -161,8 +160,18 @@
} }
var xDiff = event.clientX - this.clientXStart; var xDiff = event.clientX - this.clientXStart;
var yDiff = event.clientY - this.clientYStart; var yDiff = event.clientY - this.clientYStart;
this.element.scrollTop = this.scrollTopStart - yDiff; var scrollTop = this.scrollTopStart - yDiff;
this.element.scrollLeft = this.scrollLeftStart - xDiff; var scrollLeft = this.scrollLeftStart - xDiff;
if (this.element.scrollTo) {
this.element.scrollTo({
top: scrollTop,
left: scrollLeft,
behavior: 'instant',
});
} else {
this.element.scrollTop = scrollTop;
this.element.scrollLeft = scrollLeft;
}
if (!this.overlay.parentNode) { if (!this.overlay.parentNode) {
document.body.appendChild(this.overlay); document.body.appendChild(this.overlay);
} }

Loading…
Cancel
Save