targetj 1.0.47 → 1.0.48
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/Exports.js +1 -0
- package/package.json +1 -1
- package/src/Browser.js +1 -3
- package/src/EventListener.js +59 -61
package/Exports.js
CHANGED
package/package.json
CHANGED
package/src/Browser.js
CHANGED
|
@@ -195,9 +195,7 @@ var browser = {
|
|
|
195
195
|
nextRun = { timeStamp: this.delayProcess.timeStamp, oid: this.delayProcess.oid, delay: this.delayProcess.delay };
|
|
196
196
|
|
|
197
197
|
clearTimeout(this.delayProcess.id);
|
|
198
|
-
|
|
199
|
-
//console.log("clearing: " + oid + ", " + (this.delayProcess.timeStamp) + " vs " + timeStamp);
|
|
200
|
-
|
|
198
|
+
|
|
201
199
|
this.delayProcess.oid = oid;
|
|
202
200
|
this.delayProcess.timeStamp = timeStamp;
|
|
203
201
|
this.delayProcess.delay = delay;
|
package/src/EventListener.js
CHANGED
|
@@ -20,19 +20,18 @@ function EventListener() {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
this.eventMap = {
|
|
23
|
-
mousedown: 'touchstart',
|
|
24
23
|
touchstart: 'touchstart',
|
|
25
|
-
mousemove: 'touchmove',
|
|
26
24
|
touchmove: 'touchmove',
|
|
27
25
|
touchend: 'touchend',
|
|
28
26
|
touchcancel: 'touchend',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
mousedown: 'mousedown',
|
|
28
|
+
mousemove: 'mousemove',
|
|
29
|
+
pointerup: 'mouseup',
|
|
30
|
+
MSPointerUp: 'mouseup',
|
|
31
|
+
mouseup: 'mouseup',
|
|
32
|
+
pointercancel: 'mouseup',
|
|
33
|
+
MSPointerCancel: 'mouseup',
|
|
34
|
+
mousecancel: 'mouseup',
|
|
36
35
|
wheel: 'wheel',
|
|
37
36
|
DOMMouseScroll: 'wheel',
|
|
38
37
|
mousewheel: 'wheel',
|
|
@@ -100,58 +99,52 @@ EventListener.prototype.handleEvent = function (event) {
|
|
|
100
99
|
this.eventTagName = (event.target.tagName || "").toUpperCase();
|
|
101
100
|
this.eventName = this.eventMap[event.type];
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (this.touchCount > 0) {
|
|
127
|
-
this.move(event);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
break;
|
|
102
|
+
switch (this.eventName) {
|
|
103
|
+
|
|
104
|
+
case 'mousedown':
|
|
105
|
+
case 'touchstart':
|
|
106
|
+
this.clear();
|
|
107
|
+
this.touchCount = this.countTouches(event);
|
|
108
|
+
if (this.preventDefault(event, this.eventName)) event.preventDefault();
|
|
109
|
+
this.start(event);
|
|
110
|
+
event.stopPropagation();
|
|
111
|
+
break;
|
|
112
|
+
|
|
113
|
+
case 'mousemove':
|
|
114
|
+
case 'touchmove':
|
|
115
|
+
var touch = this.getTouch(event);
|
|
116
|
+
this.cursor.x = touch.x;
|
|
117
|
+
this.cursor.y = touch.y;
|
|
118
|
+
if (this.preventDefault(event, this.eventName)) event.preventDefault();
|
|
119
|
+
if (this.touchCount > 0) {
|
|
120
|
+
this.move(event);
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
131
124
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
125
|
+
case 'mouseup':
|
|
126
|
+
case 'touchend':
|
|
127
|
+
if (this.preventDefault(event, this.eventName)) event.preventDefault();
|
|
128
|
+
this.end(event);
|
|
129
|
+
event.stopPropagation();
|
|
130
|
+
break;
|
|
136
131
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
case 'wheel':
|
|
133
|
+
if (this.preventDefault(event, this.eventName)) event.preventDefault();
|
|
134
|
+
this.wheel(event);
|
|
135
|
+
break;
|
|
141
136
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
case 'key':
|
|
138
|
+
this.keyUpHandler(event);
|
|
139
|
+
break;
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
case 'resize':
|
|
142
|
+
tapp.dim.measureScreen();
|
|
143
|
+
break;
|
|
149
144
|
|
|
150
|
-
}
|
|
151
|
-
tapp.manager.scheduleRun(0, this.eventName + '-' + this.eventTagName);
|
|
152
145
|
}
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
|
|
147
|
+
tapp.manager.scheduleRun(0, this.eventName + '-' + this.eventTagName);
|
|
155
148
|
};
|
|
156
149
|
|
|
157
150
|
EventListener.prototype.findEventHandlers = function(event) {
|
|
@@ -169,6 +162,16 @@ EventListener.prototype.findEventHandlers = function(event) {
|
|
|
169
162
|
this.currentHandlers.pinch = pinchHandler;
|
|
170
163
|
};
|
|
171
164
|
|
|
165
|
+
EventListener.prototype.preventDefault = function(event, eventName) {
|
|
166
|
+
var tmodel = this.getTModelFromEvent(event);
|
|
167
|
+
|
|
168
|
+
if (tmodel && (tmodel.keepEventDefault() === true || (Array.isArray(tmodel.keepEventDefault()) && tmodel.keepEventDefault().includes(eventName)))) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return true;
|
|
173
|
+
};
|
|
174
|
+
|
|
172
175
|
EventListener.prototype.getTModelFromEvent = function(event) {
|
|
173
176
|
var oid = typeof event.target.getAttribute === 'function' ? event.target.getAttribute('id') : '';
|
|
174
177
|
|
|
@@ -346,9 +349,7 @@ EventListener.prototype.start = function (event) {
|
|
|
346
349
|
this.start1 = this.getTouch(event, 1);
|
|
347
350
|
|
|
348
351
|
this.cursor.x = this.start0.x;
|
|
349
|
-
this.cursor.y = this.start0.y;
|
|
350
|
-
|
|
351
|
-
return event.stopPropagation();
|
|
352
|
+
this.cursor.y = this.start0.y;
|
|
352
353
|
};
|
|
353
354
|
|
|
354
355
|
EventListener.prototype.move = function (event) {
|
|
@@ -382,8 +383,6 @@ EventListener.prototype.move = function (event) {
|
|
|
382
383
|
|
|
383
384
|
this.setCurrentTouchParam('pinchDelta', this.currentTouch.diff > 0 ? 0.3 : this.currentTouch.diff < 0 ? -0.3 : 0);
|
|
384
385
|
}
|
|
385
|
-
|
|
386
|
-
return event.stopPropagation();
|
|
387
386
|
};
|
|
388
387
|
|
|
389
388
|
EventListener.prototype.end = function (event) {
|
|
@@ -424,7 +423,6 @@ EventListener.prototype.end = function (event) {
|
|
|
424
423
|
}
|
|
425
424
|
|
|
426
425
|
this.touchCount = 0;
|
|
427
|
-
return event.stopPropagation();
|
|
428
426
|
};
|
|
429
427
|
|
|
430
428
|
EventListener.prototype.setDeltaXDeltaY = function(deltaX, deltaY, isWheel) {
|