targetj 1.0.234 → 1.0.236
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/build/BaseModel.js +56 -35
- package/build/BracketGenerator.js +3 -3
- package/build/EventListener.js +144 -20
- package/build/LocationManager.js +82 -26
- package/build/PageManager.js +1 -1
- package/build/RunScheduler.js +145 -103
- package/build/TModelManager.js +43 -28
- package/build/TUtil.js +32 -0
- package/build/TargetData.js +22 -2
- package/build/TargetExecutor.js +1 -1
- package/build/TargetManager.js +3 -3
- package/build/TargetUtil.js +93 -26
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/BaseModel.js
CHANGED
|
@@ -550,19 +550,19 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
550
550
|
return ((_this$targetValues$ke6 = this.targetValues[key]) === null || _this$targetValues$ke6 === void 0 ? void 0 : _this$targetValues$ke6.status) === 'complete' ? true : this.targetValues[key] === undefined ? undefined : false;
|
|
551
551
|
}
|
|
552
552
|
}, {
|
|
553
|
-
key: "
|
|
554
|
-
value: function
|
|
555
|
-
return _TargetUtil.TargetUtil.
|
|
553
|
+
key: "isTargetTreeComplete",
|
|
554
|
+
value: function isTargetTreeComplete(key) {
|
|
555
|
+
return _TargetUtil.TargetUtil.isTargetTreeComplete(this, key) === true;
|
|
556
556
|
}
|
|
557
557
|
}, {
|
|
558
558
|
key: "isTargetFullyCompleted",
|
|
559
559
|
value: function isTargetFullyCompleted(key) {
|
|
560
|
-
return _TargetUtil.TargetUtil.isTargetFullyCompleted(this, key);
|
|
560
|
+
return _TargetUtil.TargetUtil.isTargetFullyCompleted(this, key) === true;
|
|
561
561
|
}
|
|
562
562
|
}, {
|
|
563
563
|
key: "arePreviousTargetsComplete",
|
|
564
564
|
value: function arePreviousTargetsComplete(key) {
|
|
565
|
-
return _TargetUtil.TargetUtil.arePreviousTargetsComplete(this, key);
|
|
565
|
+
return _TargetUtil.TargetUtil.arePreviousTargetsComplete(this, key) === true;
|
|
566
566
|
}
|
|
567
567
|
}, {
|
|
568
568
|
key: "cleanupTarget",
|
|
@@ -649,9 +649,37 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
649
649
|
}, {
|
|
650
650
|
key: "isScheduledPending",
|
|
651
651
|
value: function isScheduledPending(key) {
|
|
652
|
+
var remainingTime = this.getScheduleRemainingTime(key);
|
|
653
|
+
if (_TUtil.TUtil.isDefined(remainingTime)) {
|
|
654
|
+
return remainingTime > 0;
|
|
655
|
+
}
|
|
652
656
|
var lastScheduledTime = this.getScheduleTimeStamp(key);
|
|
653
657
|
var interval = this.getTargetInterval(key);
|
|
654
|
-
return lastScheduledTime && lastScheduledTime + interval > _TUtil.TUtil.now();
|
|
658
|
+
return _TUtil.TUtil.isDefined(lastScheduledTime) && lastScheduledTime + interval > _TUtil.TUtil.now();
|
|
659
|
+
}
|
|
660
|
+
}, {
|
|
661
|
+
key: "getScheduleRemainingTime",
|
|
662
|
+
value: function getScheduleRemainingTime(key) {
|
|
663
|
+
var _this$targetValues$ke8;
|
|
664
|
+
return (_this$targetValues$ke8 = this.targetValues[key]) === null || _this$targetValues$ke8 === void 0 ? void 0 : _this$targetValues$ke8.scheduleRemainingTime;
|
|
665
|
+
}
|
|
666
|
+
}, {
|
|
667
|
+
key: "setScheduleRemainingTime",
|
|
668
|
+
value: function setScheduleRemainingTime(key, remainingTime) {
|
|
669
|
+
var targetValue = this.targetValues[key];
|
|
670
|
+
if (!targetValue) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
targetValue.scheduleRemainingTime = remainingTime;
|
|
674
|
+
}
|
|
675
|
+
}, {
|
|
676
|
+
key: "resetScheduleRemainingTime",
|
|
677
|
+
value: function resetScheduleRemainingTime(key) {
|
|
678
|
+
var targetValue = this.targetValues[key];
|
|
679
|
+
if (!targetValue) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
delete targetValue.scheduleRemainingTime;
|
|
655
683
|
}
|
|
656
684
|
}, {
|
|
657
685
|
key: "isTargetInLoop",
|
|
@@ -685,14 +713,14 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
685
713
|
}, {
|
|
686
714
|
key: "getTargetInitialValue",
|
|
687
715
|
value: function getTargetInitialValue(key) {
|
|
688
|
-
var _this$targetValues$
|
|
689
|
-
return (_this$targetValues$
|
|
716
|
+
var _this$targetValues$ke9;
|
|
717
|
+
return (_this$targetValues$ke9 = this.targetValues[key]) === null || _this$targetValues$ke9 === void 0 ? void 0 : _this$targetValues$ke9.initialValue;
|
|
690
718
|
}
|
|
691
719
|
}, {
|
|
692
720
|
key: "getLastUpdate",
|
|
693
721
|
value: function getLastUpdate(key) {
|
|
694
|
-
var _this$targetValues$
|
|
695
|
-
return (_this$targetValues$
|
|
722
|
+
var _this$targetValues$ke10;
|
|
723
|
+
return (_this$targetValues$ke10 = this.targetValues[key]) === null || _this$targetValues$ke10 === void 0 ? void 0 : _this$targetValues$ke10.lastUpdate;
|
|
696
724
|
}
|
|
697
725
|
}, {
|
|
698
726
|
key: "getDimLastUpdate",
|
|
@@ -703,8 +731,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
703
731
|
}, {
|
|
704
732
|
key: "getTargetActivationTime",
|
|
705
733
|
value: function getTargetActivationTime(key) {
|
|
706
|
-
var _this$targetValues$
|
|
707
|
-
return (_this$targetValues$
|
|
734
|
+
var _this$targetValues$ke11, _this$targetValues$ke12;
|
|
735
|
+
return (_this$targetValues$ke11 = (_this$targetValues$ke12 = this.targetValues[key]) === null || _this$targetValues$ke12 === void 0 ? void 0 : _this$targetValues$ke12.activationTime) !== null && _this$targetValues$ke11 !== void 0 ? _this$targetValues$ke11 : 0;
|
|
708
736
|
}
|
|
709
737
|
}, {
|
|
710
738
|
key: "getTargetCreationTime",
|
|
@@ -727,8 +755,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
727
755
|
}, {
|
|
728
756
|
key: "getTargetEasing",
|
|
729
757
|
value: function getTargetEasing(key) {
|
|
730
|
-
var _this$targetValues$
|
|
731
|
-
var easing = (_this$targetValues$
|
|
758
|
+
var _this$targetValues$ke13;
|
|
759
|
+
var easing = (_this$targetValues$ke13 = this.targetValues[key]) === null || _this$targetValues$ke13 === void 0 ? void 0 : _this$targetValues$ke13.easing;
|
|
732
760
|
var target = this.targets[key];
|
|
733
761
|
if (!target) {
|
|
734
762
|
return easing;
|
|
@@ -738,8 +766,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
738
766
|
}, {
|
|
739
767
|
key: "getTargetInterval",
|
|
740
768
|
value: function getTargetInterval(key) {
|
|
741
|
-
var _this$targetValues$
|
|
742
|
-
var interval = (_this$targetValues$
|
|
769
|
+
var _this$targetValues$ke14, _this$targetValues$ke15;
|
|
770
|
+
var interval = (_this$targetValues$ke14 = (_this$targetValues$ke15 = this.targetValues[key]) === null || _this$targetValues$ke15 === void 0 ? void 0 : _this$targetValues$ke15.interval) !== null && _this$targetValues$ke14 !== void 0 ? _this$targetValues$ke14 : 0;
|
|
743
771
|
var target = this.targets[key];
|
|
744
772
|
if (!target) {
|
|
745
773
|
return interval;
|
|
@@ -749,8 +777,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
749
777
|
}, {
|
|
750
778
|
key: "getTargetSteps",
|
|
751
779
|
value: function getTargetSteps(key) {
|
|
752
|
-
var _this$targetValues$
|
|
753
|
-
var steps = (_this$targetValues$
|
|
780
|
+
var _this$targetValues$ke16, _this$targetValues$ke17;
|
|
781
|
+
var steps = (_this$targetValues$ke16 = (_this$targetValues$ke17 = this.targetValues[key]) === null || _this$targetValues$ke17 === void 0 ? void 0 : _this$targetValues$ke17.steps) !== null && _this$targetValues$ke16 !== void 0 ? _this$targetValues$ke16 : 0;
|
|
754
782
|
var target = this.targets[key];
|
|
755
783
|
if (!target) {
|
|
756
784
|
return steps;
|
|
@@ -760,8 +788,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
760
788
|
}, {
|
|
761
789
|
key: "getTargetCycles",
|
|
762
790
|
value: function getTargetCycles(key) {
|
|
763
|
-
var _this$targetValues$
|
|
764
|
-
var cycles = (_this$targetValues$
|
|
791
|
+
var _this$targetValues$ke18, _this$targetValues$ke19;
|
|
792
|
+
var cycles = (_this$targetValues$ke18 = (_this$targetValues$ke19 = this.targetValues[key]) === null || _this$targetValues$ke19 === void 0 ? void 0 : _this$targetValues$ke19.cycles) !== null && _this$targetValues$ke18 !== void 0 ? _this$targetValues$ke18 : 1;
|
|
765
793
|
var target = this.targets[key];
|
|
766
794
|
if (!target) {
|
|
767
795
|
return cycles;
|
|
@@ -771,14 +799,14 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
771
799
|
}, {
|
|
772
800
|
key: "getTargetCycle",
|
|
773
801
|
value: function getTargetCycle(key) {
|
|
774
|
-
var _this$targetValues$
|
|
775
|
-
return (_this$targetValues$
|
|
802
|
+
var _this$targetValues$ke20, _this$targetValues$ke21;
|
|
803
|
+
return (_this$targetValues$ke20 = (_this$targetValues$ke21 = this.targetValues[key]) === null || _this$targetValues$ke21 === void 0 ? void 0 : _this$targetValues$ke21.cycle) !== null && _this$targetValues$ke20 !== void 0 ? _this$targetValues$ke20 : 0;
|
|
776
804
|
}
|
|
777
805
|
}, {
|
|
778
806
|
key: "getValueListPointer",
|
|
779
807
|
value: function getValueListPointer(key) {
|
|
780
|
-
var _this$targetValues$
|
|
781
|
-
return (_this$targetValues$
|
|
808
|
+
var _this$targetValues$ke22, _this$targetValues$ke23;
|
|
809
|
+
return (_this$targetValues$ke22 = (_this$targetValues$ke23 = this.targetValues[key]) === null || _this$targetValues$ke23 === void 0 ? void 0 : _this$targetValues$ke23.valuePointer) !== null && _this$targetValues$ke22 !== void 0 ? _this$targetValues$ke22 : 0;
|
|
782
810
|
}
|
|
783
811
|
}, {
|
|
784
812
|
key: "incrementTargetCycle",
|
|
@@ -1000,9 +1028,9 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
1000
1028
|
}, {
|
|
1001
1029
|
key: "addToAnimatingMap",
|
|
1002
1030
|
value: function addToAnimatingMap(key) {
|
|
1003
|
-
var _this$targetValues$
|
|
1031
|
+
var _this$targetValues$ke24, _this$getParent7;
|
|
1004
1032
|
var record = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1005
|
-
if ((_this$targetValues$
|
|
1033
|
+
if ((_this$targetValues$ke24 = this.targetValues[key]) !== null && _this$targetValues$ke24 !== void 0 && _this$targetValues$ke24.snapAnimation) {
|
|
1006
1034
|
return;
|
|
1007
1035
|
}
|
|
1008
1036
|
this.animatingMap || (this.animatingMap = new Map());
|
|
@@ -1147,9 +1175,9 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
1147
1175
|
actualOptions = value;
|
|
1148
1176
|
}
|
|
1149
1177
|
if (this.canTargetBeActivated(key)) {
|
|
1150
|
-
var _actualOptions
|
|
1178
|
+
var _actualOptions;
|
|
1151
1179
|
if ((_actualOptions = actualOptions) !== null && _actualOptions !== void 0 && _actualOptions.reset) {
|
|
1152
|
-
_TargetUtil.TargetUtil.
|
|
1180
|
+
_TargetUtil.TargetUtil.resetTargetState(this, key);
|
|
1153
1181
|
}
|
|
1154
1182
|
if (_TUtil.TUtil.isDefined(actualValue)) {
|
|
1155
1183
|
this.val("___".concat(key), actualValue);
|
|
@@ -1157,13 +1185,6 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
1157
1185
|
if (this.isVisible()) {
|
|
1158
1186
|
this.markLayoutDirty(key);
|
|
1159
1187
|
}
|
|
1160
|
-
var target = this.targets[key];
|
|
1161
|
-
if (target !== null && target !== void 0 && (_target$childAction = target.childAction) !== null && _target$childAction !== void 0 && _target$childAction.length) {
|
|
1162
|
-
target.childAction = [];
|
|
1163
|
-
}
|
|
1164
|
-
if (target !== null && target !== void 0 && (_target$addChildActio = target.addChildAction) !== null && _target$addChildActio !== void 0 && _target$addChildActio.length) {
|
|
1165
|
-
target.addChildAction = [];
|
|
1166
|
-
}
|
|
1167
1188
|
var invokerTModel = _TargetUtil.TargetUtil.currentTModel;
|
|
1168
1189
|
var invokerTarget = _TargetUtil.TargetUtil.currentTargetName;
|
|
1169
1190
|
var targetValue = this.targetValues[key] || _TargetUtil.TargetUtil.emptyValue();
|
|
@@ -145,13 +145,13 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
145
145
|
var bracket = targetBracket;
|
|
146
146
|
bracket.startIndex = Math.min(bracket.startIndex, index);
|
|
147
147
|
bracket.endIndex = bracket.startIndex + bracket.allChildrenList.length;
|
|
148
|
-
bracket.
|
|
148
|
+
bracket.currentBrakcetStatus = 2;
|
|
149
149
|
bracket.markLayoutDirty('update');
|
|
150
150
|
bracket = targetBracket.getParent();
|
|
151
151
|
while (bracket instanceof _Bracket.Bracket) {
|
|
152
152
|
bracket.startIndex = Math.min(bracket.startIndex, index);
|
|
153
153
|
bracket.endIndex = Math.max(bracket.endIndex, index + 1);
|
|
154
|
-
bracket.
|
|
154
|
+
bracket.currentBrakcetStatus = 2;
|
|
155
155
|
bracket.markLayoutDirty('update');
|
|
156
156
|
bracket = bracket.getParent();
|
|
157
157
|
}
|
|
@@ -296,7 +296,7 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
296
296
|
value: function markBracketDirty(bracket) {
|
|
297
297
|
var current = bracket;
|
|
298
298
|
while (current && current.type === 'BI') {
|
|
299
|
-
current.
|
|
299
|
+
current.currentBrakcetStatus = 2;
|
|
300
300
|
current.markLayoutDirty('update');
|
|
301
301
|
current = current.parent;
|
|
302
302
|
}
|
package/build/EventListener.js
CHANGED
|
@@ -60,6 +60,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
60
60
|
this.swipeStartY = 0;
|
|
61
61
|
this.currentEventName = '';
|
|
62
62
|
this.currentEventType = '';
|
|
63
|
+
this.currentEventTModel = undefined;
|
|
63
64
|
this.currentOriginalEvent = undefined;
|
|
64
65
|
this.currentKey = '';
|
|
65
66
|
this.currentHandlers = {
|
|
@@ -83,6 +84,11 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
83
84
|
this.allEvents = {};
|
|
84
85
|
this.windowScrollX = window.scrollX | 0;
|
|
85
86
|
this.windowScrollY = window.scrollY | 0;
|
|
87
|
+
this.windowScrollEndTimer = 0;
|
|
88
|
+
this.scrollEndTimeStamp = {
|
|
89
|
+
x: 0,
|
|
90
|
+
y: 0
|
|
91
|
+
};
|
|
86
92
|
this.windowEpoch = 0;
|
|
87
93
|
this.eventEpoch = 0;
|
|
88
94
|
Object.values(_TargetData.TargetData.events).forEach(function (group) {
|
|
@@ -221,8 +227,9 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
221
227
|
}, {
|
|
222
228
|
key: "resetEventsOnTimeout",
|
|
223
229
|
value: function resetEventsOnTimeout() {
|
|
224
|
-
if (this.
|
|
225
|
-
var
|
|
230
|
+
if (this.scrollEndTimeStamp.x > 0 || this.scrollEndTimeStamp.y > 0 || this.currentTouch.pinchDelta) {
|
|
231
|
+
var now = _TUtil.TUtil.now();
|
|
232
|
+
var diff = Math.max(this.scrollEndTimeStamp.x - now, this.scrollEndTimeStamp.y - now);
|
|
226
233
|
if (diff > 100) {
|
|
227
234
|
this.currentTouch.deltaY *= 0.95;
|
|
228
235
|
this.currentTouch.deltaX *= 0.95;
|
|
@@ -236,16 +243,19 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
236
243
|
if (Math.abs(this.currentTouch.pinchDelta) < 0.1) {
|
|
237
244
|
this.currentTouch.pinchDelta = 0;
|
|
238
245
|
}
|
|
239
|
-
if (this.currentTouch.deltaX === 0 && this.currentTouch.deltaY === 0 && this.currentTouch.pinchDelta === 0) {
|
|
240
|
-
this.touchTimeStamp = 0;
|
|
241
|
-
}
|
|
242
246
|
}
|
|
243
|
-
if (diff <= 0
|
|
247
|
+
if (diff <= 0) {
|
|
244
248
|
this.currentTouch.deltaY = 0;
|
|
245
249
|
this.currentTouch.deltaX = 0;
|
|
246
250
|
this.currentTouch.pinchDelta = 0;
|
|
247
|
-
|
|
248
|
-
|
|
251
|
+
}
|
|
252
|
+
if (!this.currentTouch.deltaX && this.scrollEndTimeStamp.x && now >= this.scrollEndTimeStamp.x && this.touchCount === 0) {
|
|
253
|
+
this.scrollEndTimeStamp.x = 0;
|
|
254
|
+
this.queueScrollEndEvent('x', this.currentHandlers.scrollLeft);
|
|
255
|
+
}
|
|
256
|
+
if (!this.currentTouch.deltaY && this.scrollEndTimeStamp.y && now >= this.scrollEndTimeStamp.y && this.touchCount === 0) {
|
|
257
|
+
this.queueScrollEndEvent('y', this.currentHandlers.scrollTop);
|
|
258
|
+
this.scrollEndTimeStamp.y = 0;
|
|
249
259
|
}
|
|
250
260
|
(0, _App.getRunScheduler)().schedule(10, 'scroll decay');
|
|
251
261
|
}
|
|
@@ -297,12 +307,13 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
297
307
|
if (this.eventQueue.length === 0) {
|
|
298
308
|
this.currentEventName = '';
|
|
299
309
|
this.currentEventType = '';
|
|
310
|
+
this.currentEventTModel = undefined;
|
|
300
311
|
this.currentOriginalEvent = undefined;
|
|
301
312
|
this.currentKey = '';
|
|
302
313
|
return;
|
|
303
314
|
}
|
|
304
315
|
var lastEvent = this.eventQueue.shift();
|
|
305
|
-
if (this.canFindHandlers) {
|
|
316
|
+
if (this.canFindHandlers && !lastEvent.synthetic) {
|
|
306
317
|
this.findEventHandlers(lastEvent);
|
|
307
318
|
}
|
|
308
319
|
if (lastEvent.eventType === 'end' || lastEvent.eventType === 'click') {
|
|
@@ -316,6 +327,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
316
327
|
}
|
|
317
328
|
this.currentEventName = lastEvent.eventName;
|
|
318
329
|
this.currentEventType = lastEvent.eventType;
|
|
330
|
+
this.currentEventTModel = lastEvent.tmodel;
|
|
319
331
|
this.currentOriginalEvent = lastEvent.originalEvent;
|
|
320
332
|
this.currentTouch.key = '';
|
|
321
333
|
}
|
|
@@ -332,7 +344,16 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
332
344
|
}, {
|
|
333
345
|
key: "handleEvent",
|
|
334
346
|
value: function handleEvent(event, isDocEvent, isWindowEvent) {
|
|
335
|
-
var _this$lastEvent,
|
|
347
|
+
var _this$lastEvent,
|
|
348
|
+
_tmodel,
|
|
349
|
+
_tmodel2,
|
|
350
|
+
_this$currentHandlers2,
|
|
351
|
+
_this$currentHandlers3,
|
|
352
|
+
_this$currentHandlers4,
|
|
353
|
+
_this$currentHandlers5,
|
|
354
|
+
_this$currentHandlers7,
|
|
355
|
+
_this$currentHandlers8,
|
|
356
|
+
_this7 = this;
|
|
336
357
|
if (!event) {
|
|
337
358
|
return;
|
|
338
359
|
}
|
|
@@ -435,7 +456,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
435
456
|
}
|
|
436
457
|
if (this.touchCount > 0) {
|
|
437
458
|
var _this$currentHandlers6;
|
|
438
|
-
this.
|
|
459
|
+
this.scrollEndTimeStamp.x = 0;
|
|
460
|
+
this.scrollEndTimeStamp.y = 0;
|
|
439
461
|
this.move(event);
|
|
440
462
|
event.stopPropagation();
|
|
441
463
|
(_this$currentHandlers6 = this.currentHandlers.swipe) === null || _this$currentHandlers6 === void 0 || _this$currentHandlers6.markLayoutDirty('swipe-event');
|
|
@@ -485,7 +507,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
485
507
|
event.preventDefault();
|
|
486
508
|
event.stopPropagation();
|
|
487
509
|
}
|
|
488
|
-
this.
|
|
510
|
+
this.touchCount = 0;
|
|
489
511
|
this.wheel(event);
|
|
490
512
|
break;
|
|
491
513
|
case 'mouseleave':
|
|
@@ -521,27 +543,92 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
521
543
|
case 'resize':
|
|
522
544
|
this.windowEpoch++;
|
|
523
545
|
this.resizeRoot();
|
|
524
|
-
(0, _App.getManager)().
|
|
546
|
+
(0, _App.getManager)().getAvailableDoms().forEach(function (t) {
|
|
525
547
|
if (t.targets['onResize']) {
|
|
526
548
|
t.markLayoutDirty('resize-event');
|
|
527
549
|
}
|
|
528
550
|
});
|
|
529
551
|
break;
|
|
530
552
|
case 'scroll':
|
|
553
|
+
clearTimeout(this.windowScrollEndTimer);
|
|
554
|
+
this.windowScrollEndTimer = setTimeout(function () {
|
|
555
|
+
_this7.queueWindowScrollEndEvent('x', tmodel);
|
|
556
|
+
_this7.queueWindowScrollEndEvent('y', tmodel);
|
|
557
|
+
_this7.windowScrollEndTimer = 0;
|
|
558
|
+
}, 120);
|
|
531
559
|
if (isWindowEvent) {
|
|
532
560
|
this.windowEpoch++;
|
|
533
561
|
this.windowScrollX = window.scrollX | 0;
|
|
534
562
|
this.windowScrollY = window.scrollY | 0;
|
|
535
563
|
(0, _App.getLocationManager)().domIslandSet.forEach(function (t) {
|
|
536
|
-
t.markLayoutDirty('
|
|
564
|
+
t.markLayoutDirty('window-scroll-event');
|
|
537
565
|
});
|
|
538
566
|
} else {
|
|
539
|
-
tmodel.markLayoutDirty('
|
|
567
|
+
tmodel.markLayoutDirty('container-scroll-event');
|
|
568
|
+
clearTimeout(tmodel.scrollEndTimer);
|
|
569
|
+
tmodel.scrollEndTimer = setTimeout(function () {
|
|
570
|
+
_this7.queueWindowScrollEndEvent('x', tmodel, 'container');
|
|
571
|
+
_this7.queueWindowScrollEndEvent('y', tmodel, 'container');
|
|
572
|
+
tmodel.scrollEndTimer = 0;
|
|
573
|
+
}, 120);
|
|
540
574
|
}
|
|
541
575
|
break;
|
|
542
576
|
}
|
|
543
577
|
(0, _App.getRunScheduler)().schedule(0, "".concat(originalName, "-").concat(eventName, "-").concat((event.target.tagName || '').toUpperCase()));
|
|
544
578
|
}
|
|
579
|
+
}, {
|
|
580
|
+
key: "queueScrollEndEvent",
|
|
581
|
+
value: function queueScrollEndEvent(axis, handler) {
|
|
582
|
+
if (!handler) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
var eventType = axis === 'x' ? 'scrollleftend' : 'scrolltopend';
|
|
586
|
+
this.removeScrollEndEvents(axis);
|
|
587
|
+
this.eventQueue.push({
|
|
588
|
+
eventName: eventType,
|
|
589
|
+
eventType: eventType,
|
|
590
|
+
originalName: eventType,
|
|
591
|
+
tmodel: handler,
|
|
592
|
+
originalEvent: undefined,
|
|
593
|
+
timeStamp: _TUtil.TUtil.now(),
|
|
594
|
+
synthetic: true
|
|
595
|
+
});
|
|
596
|
+
this.eventEpoch++;
|
|
597
|
+
handler.markEventDirty();
|
|
598
|
+
handler.markLayoutDirty(eventType);
|
|
599
|
+
(0, _App.getRunScheduler)().schedule(0, eventType);
|
|
600
|
+
}
|
|
601
|
+
}, {
|
|
602
|
+
key: "queueWindowScrollEndEvent",
|
|
603
|
+
value: function queueWindowScrollEndEvent(axis, tmodel) {
|
|
604
|
+
var scrollSource = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'window';
|
|
605
|
+
var eventType = axis === 'x' ? 'windowscrollleftend' : 'windowscrolltopend';
|
|
606
|
+
this.removeScrollEndEvents(axis);
|
|
607
|
+
this.eventQueue.push({
|
|
608
|
+
eventName: eventType,
|
|
609
|
+
eventType: eventType,
|
|
610
|
+
originalName: eventType,
|
|
611
|
+
tmodel: tmodel,
|
|
612
|
+
originalEvent: undefined,
|
|
613
|
+
timeStamp: _TUtil.TUtil.now(),
|
|
614
|
+
synthetic: true,
|
|
615
|
+
scrollSource: scrollSource
|
|
616
|
+
});
|
|
617
|
+
this.eventEpoch++;
|
|
618
|
+
(0, _App.getLocationManager)().domIslandSet.forEach(function (t) {
|
|
619
|
+
t.markEventDirty();
|
|
620
|
+
t.markLayoutDirty(eventType);
|
|
621
|
+
});
|
|
622
|
+
(0, _App.getRunScheduler)().schedule(0, eventType);
|
|
623
|
+
}
|
|
624
|
+
}, {
|
|
625
|
+
key: "removeScrollEndEvents",
|
|
626
|
+
value: function removeScrollEndEvents(axis) {
|
|
627
|
+
var types = axis === 'x' ? new Set(['scrollleftend', 'windowscrollleftend']) : new Set(['scrolltopend', 'windowscrolltopend']);
|
|
628
|
+
this.eventQueue = this.eventQueue.filter(function (event) {
|
|
629
|
+
return !types.has(event.eventType);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
545
632
|
}, {
|
|
546
633
|
key: "resizeRoot",
|
|
547
634
|
value: function resizeRoot() {
|
|
@@ -607,7 +694,6 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
607
694
|
this.clearEnd();
|
|
608
695
|
this.clearTouch();
|
|
609
696
|
this.eventQueue.length = 0;
|
|
610
|
-
this.touchTimeStamp = 0;
|
|
611
697
|
this.touchCount = 0;
|
|
612
698
|
this.canFindHandlers = true;
|
|
613
699
|
this.lastEvent = undefined;
|
|
@@ -616,6 +702,10 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
616
702
|
this.swipeStartX = 0;
|
|
617
703
|
this.swipeStartY = 0;
|
|
618
704
|
this.hovered.clear();
|
|
705
|
+
clearTimeout(this.windowScrollEndTimer);
|
|
706
|
+
this.windowScrollEndTimer = 0;
|
|
707
|
+
this.scrollEndTimeStamp.x = 0;
|
|
708
|
+
this.scrollEndTimeStamp.y = 0;
|
|
619
709
|
}
|
|
620
710
|
}, {
|
|
621
711
|
key: "deltaX",
|
|
@@ -760,6 +850,11 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
760
850
|
value: function getEventType() {
|
|
761
851
|
return this.currentEventType;
|
|
762
852
|
}
|
|
853
|
+
}, {
|
|
854
|
+
key: "getEventTModel",
|
|
855
|
+
value: function getEventTModel() {
|
|
856
|
+
return this.currentEventTModel;
|
|
857
|
+
}
|
|
763
858
|
}, {
|
|
764
859
|
key: "isClickHandler",
|
|
765
860
|
value: function isClickHandler(handler) {
|
|
@@ -834,6 +929,26 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
834
929
|
value: function isScrollTopHandler(handler) {
|
|
835
930
|
return this.currentHandlers.scrollTop === handler;
|
|
836
931
|
}
|
|
932
|
+
}, {
|
|
933
|
+
key: "isScrollLeftEndHandler",
|
|
934
|
+
value: function isScrollLeftEndHandler(handler) {
|
|
935
|
+
return this.currentHandlers.scrollLeft === handler && this.currentEventType === 'scrollleftend';
|
|
936
|
+
}
|
|
937
|
+
}, {
|
|
938
|
+
key: "isScrollTopEndHandler",
|
|
939
|
+
value: function isScrollTopEndHandler(handler) {
|
|
940
|
+
return this.currentHandlers.scrollTop === handler && this.currentEventType === 'scrolltopend';
|
|
941
|
+
}
|
|
942
|
+
}, {
|
|
943
|
+
key: "isScrolling",
|
|
944
|
+
value: function isScrolling() {
|
|
945
|
+
return this.scrollEndTimeStamp.x > 0 || this.scrollEndTimeStamp.y > 0;
|
|
946
|
+
}
|
|
947
|
+
}, {
|
|
948
|
+
key: "isWindowScrolling",
|
|
949
|
+
value: function isWindowScrolling() {
|
|
950
|
+
return this.windowScrollEndTimer > 0;
|
|
951
|
+
}
|
|
837
952
|
}, {
|
|
838
953
|
key: "isPinchHandler",
|
|
839
954
|
value: function isPinchHandler(handler) {
|
|
@@ -919,15 +1034,15 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
919
1034
|
var momentum;
|
|
920
1035
|
if (this.currentTouch.orientation === 'horizontal' && Math.abs(deltaX) > 0 && period > 0) {
|
|
921
1036
|
momentum = _TUtil.TUtil.momentum(0, deltaX, period);
|
|
922
|
-
this.
|
|
923
|
-
if (this.
|
|
1037
|
+
this.scrollEndTimeStamp.x = this.end0.timeStamp + momentum.duration;
|
|
1038
|
+
if (this.scrollEndTimeStamp.x - _TUtil.TUtil.now() > 0) {
|
|
924
1039
|
this.currentTouch.deltaX = momentum.distance;
|
|
925
1040
|
this.currentTouch.manualMomentumFlag = true;
|
|
926
1041
|
}
|
|
927
1042
|
} else if (this.currentTouch.orientation === 'vertical' && Math.abs(deltaY) > 0 && period > 0) {
|
|
928
1043
|
momentum = _TUtil.TUtil.momentum(0, deltaY, period);
|
|
929
|
-
this.
|
|
930
|
-
if (this.
|
|
1044
|
+
this.scrollEndTimeStamp.y = this.end0.timeStamp + momentum.duration;
|
|
1045
|
+
if (this.scrollEndTimeStamp.y - _TUtil.TUtil.now() > 0) {
|
|
931
1046
|
this.currentTouch.deltaY = momentum.distance;
|
|
932
1047
|
this.currentTouch.manualMomentumFlag = true;
|
|
933
1048
|
}
|
|
@@ -945,10 +1060,16 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
945
1060
|
} else if (this.currentTouch.orientation === 'none' || this.currentTouch.orientation === 'horizontal' && diff <= -2 || this.currentTouch.orientation === 'vertical') {
|
|
946
1061
|
this.currentTouch.orientation = 'vertical';
|
|
947
1062
|
}
|
|
1063
|
+
var now = _TUtil.TUtil.now();
|
|
1064
|
+
var endDelay = source === 'touch' ? 0 : 500;
|
|
948
1065
|
if (this.currentTouch.orientation === 'horizontal') {
|
|
949
1066
|
this.currentTouch.dir = deltaX < 0 ? 'left' : deltaX > 0 ? 'right' : this.currentTouch.dir;
|
|
1067
|
+
this.scrollEndTimeStamp.x = now + endDelay;
|
|
1068
|
+
this.removeScrollEndEvents('x');
|
|
950
1069
|
} else {
|
|
951
1070
|
this.currentTouch.dir = deltaY < 0 ? 'up' : deltaY > 0 ? 'down' : this.currentTouch.dir;
|
|
1071
|
+
this.scrollEndTimeStamp.y = now + endDelay;
|
|
1072
|
+
this.removeScrollEndEvents('y');
|
|
952
1073
|
}
|
|
953
1074
|
this.currentTouch.source = source;
|
|
954
1075
|
|
|
@@ -957,6 +1078,9 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
|
|
|
957
1078
|
this.currentTouch.prevDeltaY += deltaY;
|
|
958
1079
|
this.currentTouch.deltaX = this.currentTouch.prevDeltaX;
|
|
959
1080
|
this.currentTouch.deltaY = this.currentTouch.prevDeltaY;
|
|
1081
|
+
if (endDelay && (this.scrollEndTimeStamp.x > 0 || this.scrollEndTimeStamp.y > 0)) {
|
|
1082
|
+
(0, _App.getRunScheduler)().schedule(endDelay, 'scroll-end-check');
|
|
1083
|
+
}
|
|
960
1084
|
}
|
|
961
1085
|
}, {
|
|
962
1086
|
key: "wheel",
|