Permalink
Browse files

fix(core,util): add defence code for some devices

ref #1118
1 parent a128da4 commit 9520169e0fb8734c9c49148456bdcd1fe631818b @sculove sculove committed Jan 3, 2017
Showing with 9 additions and 3 deletions.
  1. +7 −1 src/core.js
  2. +2 −2 src/utils.js
View
@@ -426,7 +426,13 @@ IScroll.prototype = {
if(utils.hasPointer && !this.options.disablePointer) {
// The wrapper should have `touchAction` property for using pointerEvent.
- this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough);
+ this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough, true);
+
+ // case. not support 'pinch-zoom'
+ // https://github.com/cubiq/iscroll/issues/1118#issuecomment-270057583
+ if (!this.wrapper.style[utils.style.touchAction]) {
+ this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough, false);
+ }
}
this.wrapperOffset = utils.offset(this.wrapper);
View
@@ -277,14 +277,14 @@ var utils = (function () {
}
};
- me.getTouchAction = function(eventPassthrough) {
+ me.getTouchAction = function(eventPassthrough, addPinch) {
var touchAction = 'none';
if ( eventPassthrough === 'vertical' ) {
touchAction = 'pan-y';
} else if (eventPassthrough === 'horizontal' ) {
touchAction = 'pan-x';
}
- if (touchAction != 'none') {
+ if (addPinch && touchAction != 'none') {
// add pinch-zoom support if the browser supports it, but if not (eg. Chrome <55) do nothing
touchAction += ' pinch-zoom';
}

0 comments on commit 9520169

Please sign in to comment.