@dolphinweex/weex-vue-render 0.2.42 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +32 -9
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -1547,7 +1547,7 @@ function calc(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
|
1547
1547
|
* @event
|
|
1548
1548
|
* @param {event} event
|
|
1549
1549
|
*/
|
|
1550
|
-
function touchstartHandler(event) {
|
|
1550
|
+
const touchstartHandler = throttle(function touchstartHandler(event) {
|
|
1551
1551
|
|
|
1552
1552
|
if (Object.keys(gestures).length === 0) {
|
|
1553
1553
|
docEl.addEventListener('touchmove', touchmoveHandler, true);
|
|
@@ -1603,7 +1603,7 @@ function touchstartHandler(event) {
|
|
|
1603
1603
|
touchEvent: event
|
|
1604
1604
|
});
|
|
1605
1605
|
}
|
|
1606
|
-
}
|
|
1606
|
+
},300,true)
|
|
1607
1607
|
|
|
1608
1608
|
/**
|
|
1609
1609
|
* take over touchmove events, and handle pan and dual related gestures.
|
|
@@ -7180,6 +7180,9 @@ function getRefresh (weex) {
|
|
|
7180
7180
|
},
|
|
7181
7181
|
methods: {
|
|
7182
7182
|
pulling: function pulling (offsetY) {
|
|
7183
|
+
if(weex.sliderHorizontalScrolling){//轮播图滚动中不允许触发
|
|
7184
|
+
return
|
|
7185
|
+
}
|
|
7183
7186
|
if ( offsetY === void 0 ) offsetY = 0;
|
|
7184
7187
|
|
|
7185
7188
|
this.height = offsetY;
|
|
@@ -7737,7 +7740,8 @@ var slideMixin = {
|
|
|
7737
7740
|
}
|
|
7738
7741
|
},
|
|
7739
7742
|
|
|
7740
|
-
_slideTo: function _slideTo(index, isTouchScroll) {
|
|
7743
|
+
_slideTo: function _slideTo(index, isTouchScroll, transtionTime = null) {
|
|
7744
|
+
let slideTranstionTime = this.isTransform ? `transform ${transtionTime || TRANSITION_TIME / 1600}s ease-out` : `left ${transtionTime || TRANSITION_TIME / 1600}s ease-out`
|
|
7741
7745
|
var this$1 = this;
|
|
7742
7746
|
if (this.frameCount <= 0) {
|
|
7743
7747
|
return;
|
|
@@ -7785,7 +7789,7 @@ var slideMixin = {
|
|
|
7785
7789
|
lastNode.style.zIndex = '10';
|
|
7786
7790
|
|
|
7787
7791
|
// 执行向左滑动动画
|
|
7788
|
-
inner.style.transition =
|
|
7792
|
+
inner.style.transition = slideTranstionTime;
|
|
7789
7793
|
this.innerOffset += this._wrapperWidth;
|
|
7790
7794
|
this._setPosition(inner, this.innerOffset);
|
|
7791
7795
|
|
|
@@ -7798,7 +7802,7 @@ var slideMixin = {
|
|
|
7798
7802
|
this._setPosition(inner, this.innerOffset);
|
|
7799
7803
|
|
|
7800
7804
|
setTimeout(() => {
|
|
7801
|
-
inner.style.transition =
|
|
7805
|
+
inner.style.transition = slideTranstionTime;
|
|
7802
7806
|
}, 50);
|
|
7803
7807
|
}, TRANSITION_TIME);
|
|
7804
7808
|
|
|
@@ -7814,7 +7818,7 @@ var slideMixin = {
|
|
|
7814
7818
|
inner.appendChild(cloneNode);
|
|
7815
7819
|
|
|
7816
7820
|
// 执行向右滑动动画
|
|
7817
|
-
inner.style.transition =
|
|
7821
|
+
inner.style.transition = slideTranstionTime;
|
|
7818
7822
|
this.innerOffset -= this._wrapperWidth;
|
|
7819
7823
|
this._setPosition(inner, this.innerOffset);
|
|
7820
7824
|
|
|
@@ -7830,7 +7834,7 @@ var slideMixin = {
|
|
|
7830
7834
|
this._setPosition(inner, 0);
|
|
7831
7835
|
|
|
7832
7836
|
setTimeout(() => {
|
|
7833
|
-
inner.style.transition =
|
|
7837
|
+
inner.style.transition = slideTranstionTime;
|
|
7834
7838
|
}, 50);
|
|
7835
7839
|
}, TRANSITION_TIME);
|
|
7836
7840
|
|
|
@@ -7838,13 +7842,13 @@ var slideMixin = {
|
|
|
7838
7842
|
} else {
|
|
7839
7843
|
// 正常切换
|
|
7840
7844
|
this.innerOffset = -index * this._wrapperWidth;
|
|
7841
|
-
inner.style.transition =
|
|
7845
|
+
inner.style.transition = slideTranstionTime;
|
|
7842
7846
|
this._setPosition(inner, this.innerOffset);
|
|
7843
7847
|
}
|
|
7844
7848
|
} else {
|
|
7845
7849
|
// 非无限轮播的正常切换
|
|
7846
7850
|
this.innerOffset = -index * this._wrapperWidth;
|
|
7847
|
-
inner.style.transition =
|
|
7851
|
+
inner.style.transition = slideTranstionTime;
|
|
7848
7852
|
this._setPosition(inner, this.innerOffset);
|
|
7849
7853
|
}
|
|
7850
7854
|
|
|
@@ -8259,6 +8263,8 @@ var slideMixin = {
|
|
|
8259
8263
|
if (!this.scrollable || this.frameCount<=1) {
|
|
8260
8264
|
return // 🚫 禁止滚动行为
|
|
8261
8265
|
}
|
|
8266
|
+
this.lastMoveTime = Date.now();
|
|
8267
|
+
this.lastMovePosition = event.touches[0].pageX;
|
|
8262
8268
|
var touch = event.changedTouches[0];
|
|
8263
8269
|
this._stopAutoPlay();
|
|
8264
8270
|
var inner = this.$refs.inner;
|
|
@@ -8306,11 +8312,26 @@ var slideMixin = {
|
|
|
8306
8312
|
var offsetY = touch.pageY - startY;
|
|
8307
8313
|
tp.offsetX = offsetX;
|
|
8308
8314
|
tp.offsetY = offsetY;
|
|
8315
|
+
|
|
8316
|
+
const now = Date.now();
|
|
8317
|
+
const deltaTime = now - this.lastMoveTime;
|
|
8318
|
+
const deltaX = Math.abs(event.touches[0].pageX - this.lastMovePosition);
|
|
8319
|
+
if (deltaTime > 0) {
|
|
8320
|
+
this.velocity = deltaX / deltaTime; // 像素/毫秒
|
|
8321
|
+
// 计算动画时间,速度越大动画时间越短
|
|
8322
|
+
const baseTime = TRANSITION_TIME / 1000; // 基准时间
|
|
8323
|
+
const minTime = 0.1; // 最小动画时间(秒)
|
|
8324
|
+
this.transitionDuration = Math.max(minTime, baseTime / (this.velocity + 1));
|
|
8325
|
+
}
|
|
8326
|
+
|
|
8327
|
+
this.lastMoveTime = now;
|
|
8328
|
+
this.lastMovePosition = event.touches[0].pageX;
|
|
8309
8329
|
var isV = tp.isVertical;
|
|
8310
8330
|
if (typeof isV === 'undefined') {
|
|
8311
8331
|
isV = tp.isVertical = Math.abs(offsetX) < Math.abs(offsetY);
|
|
8312
8332
|
if (!isV) {
|
|
8313
8333
|
this._emitScrollEvent('scrollstart');
|
|
8334
|
+
weex.sliderHorizontalScrolling = true;
|
|
8314
8335
|
}
|
|
8315
8336
|
}
|
|
8316
8337
|
// vertical scroll. just ignore it.
|
|
@@ -8393,6 +8414,7 @@ var slideMixin = {
|
|
|
8393
8414
|
},
|
|
8394
8415
|
|
|
8395
8416
|
_handleTouchEnd: function _handleTouchEnd (event) {
|
|
8417
|
+
weex.sliderHorizontalScrolling = false;
|
|
8396
8418
|
var inner = this.$refs.inner;
|
|
8397
8419
|
if (touchSliderInstance == inner) {
|
|
8398
8420
|
touchSliderInstance= null;
|
|
@@ -8422,6 +8444,7 @@ var slideMixin = {
|
|
|
8422
8444
|
},
|
|
8423
8445
|
|
|
8424
8446
|
_handleTouchCancel: function _handleTouchCancel (event) {
|
|
8447
|
+
weex.sliderHorizontalScrolling = false;
|
|
8425
8448
|
var inner = this.$refs.inner;
|
|
8426
8449
|
if (touchSliderInstance == inner) {
|
|
8427
8450
|
touchSliderInstance= null;
|
package/package.json
CHANGED