targetj 1.0.66 → 1.0.68
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 +4 -0
- package/package.json +1 -1
- package/src/$Dom.js +9 -5
- package/src/App.js +5 -16
- package/src/Bracket.js +4 -4
- package/src/ColorUtil.js +164 -0
- package/src/Easing.js +41 -0
- package/src/EventListener.js +21 -19
- package/src/LocationManager.js +111 -61
- package/src/Moves.js +35 -0
- package/src/SearchUtil.js +7 -0
- package/src/TModel.js +286 -193
- package/src/TModelManager.js +247 -93
- package/src/TUtil.js +20 -68
- package/src/TargetExecutor.js +113 -0
- package/src/TargetManager.js +144 -127
- package/src/TargetUtil.js +176 -124
- package/src/Viewport.js +20 -14
package/Exports.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export * from "./src/App.js"
|
|
2
2
|
export * from "./src/TModel.js"
|
|
3
|
+
export * from "./src/Moves.js"
|
|
3
4
|
export * from "./src/SearchUtil.js"
|
|
4
5
|
export * from "./src/TargetUtil.js"
|
|
5
6
|
export * from "./src/TUtil.js"
|
|
7
|
+
export * from "./src/ColorUtil.js"
|
|
6
8
|
export * from "./src/Browser.js"
|
|
7
9
|
export * from "./src/Bracket.js"
|
|
10
|
+
export * from "./src/ColorUtil.js"
|
|
11
|
+
export * from "./src/Easing.js"
|
package/package.json
CHANGED
package/src/$Dom.js
CHANGED
|
@@ -54,7 +54,7 @@ $Dom.prototype.value = function(value) {
|
|
|
54
54
|
if (!this.element) return;
|
|
55
55
|
|
|
56
56
|
if (TUtil.isDefined(value)) {
|
|
57
|
-
this.element.value = value
|
|
57
|
+
this.element.value = value;
|
|
58
58
|
} else {
|
|
59
59
|
return this.element.value;
|
|
60
60
|
}
|
|
@@ -260,10 +260,14 @@ $Dom.prototype.transform = function(x, y, rotate, scale) {
|
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
$Dom.prototype.createTrasformValue = function(x, y, rotate, scale) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return
|
|
263
|
+
var xy = TUtil.isDefined(x) && TUtil.isDefined(y) ? 'translate(' + (x !== 0 ? x + 'px' : '0') + ',' + (y !== 0 ? y + 'px' : '0') + ') ': '';
|
|
264
|
+
rotate = TUtil.isDefined(rotate) ? 'rotate(' + rotate + 'deg) ' : '';
|
|
265
|
+
scale = TUtil.isDefined(scale) ? 'scale(' + scale + ')' : '';
|
|
266
|
+
return (xy + rotate + scale).trim();
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
$Dom.prototype.animate = function(keyFrames, options) {
|
|
270
|
+
return this.element.animate(keyFrames, options);
|
|
267
271
|
};
|
|
268
272
|
|
|
269
273
|
$Dom.prototype.getContext = function(type, selector) {
|
package/src/App.js
CHANGED
|
@@ -122,7 +122,7 @@ function AppFn(firstChild) {
|
|
|
122
122
|
my.events.addWindowHandlers();
|
|
123
123
|
|
|
124
124
|
my.dim.measureScreen();
|
|
125
|
-
my.resetRuns();
|
|
125
|
+
my.manager.resetRuns();
|
|
126
126
|
|
|
127
127
|
my.runningFlag = true;
|
|
128
128
|
|
|
@@ -143,28 +143,17 @@ function AppFn(firstChild) {
|
|
|
143
143
|
|
|
144
144
|
my.events.clearAll();
|
|
145
145
|
|
|
146
|
-
my.resetRuns();
|
|
146
|
+
my.manager.resetRuns();
|
|
147
147
|
|
|
148
148
|
return my;
|
|
149
149
|
};
|
|
150
|
-
|
|
151
|
-
my.resetRuns = function() {
|
|
152
|
-
my.manager.nextRuns = [];
|
|
153
|
-
my.manager.runningStep = 0;
|
|
154
|
-
my.manager.runningFlag = false;
|
|
155
|
-
my.manager.rerunFlag = false;
|
|
156
|
-
};
|
|
157
150
|
|
|
158
151
|
my.reset = function() {
|
|
159
152
|
my.manager.lists.visible.forEach(function(tmodel) { tmodel.domValues = {}; });
|
|
160
|
-
my.manager.
|
|
161
|
-
my.manager.lists.invisibleDom.length = 0;
|
|
162
|
-
my.manager.lists.deletedTModel.length = 0;
|
|
163
|
-
my.manager.lists.visibleNoDom.length = 0;
|
|
164
|
-
my.manager.visibleTypeMap = {};
|
|
165
|
-
my.manager.visibleOidMap = {};
|
|
166
|
-
my.manager.targetMethodMap = {};
|
|
153
|
+
my.manager.clear();
|
|
167
154
|
my.locationManager.hasLocationList.length = 0;
|
|
155
|
+
my.locationManager.screenWidth = 0;
|
|
156
|
+
my.locationManager.screenHeight = 0;
|
|
168
157
|
SearchUtil.foundParentWithTarget = {};
|
|
169
158
|
SearchUtil.foundTypeMap = {};
|
|
170
159
|
SearchUtil.foundTargetMap = {};
|
package/src/Bracket.js
CHANGED
|
@@ -26,7 +26,7 @@ function Bracket(parent) {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
tm.getInnerXEast = function() {
|
|
29
|
-
return TUtil.isDefined(tm.getRealParent().
|
|
29
|
+
return TUtil.isDefined(tm.getRealParent().val('innerXEast')) ? this.getRealParent().val('innerXEast') : this.getRealParent().absX + this.getRealParent().getWidth();
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
tm.getInnerContentHeight = function() {
|
|
@@ -55,11 +55,11 @@ function Bracket(parent) {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
tm.isVisible = function () {
|
|
58
|
-
return this.
|
|
58
|
+
return this.visibilityStatus.top && this.visibilityStatus.bottom;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
tm.
|
|
62
|
-
this.getRealParent().
|
|
61
|
+
tm.addToUpdatingChildren = function(child) {
|
|
62
|
+
this.getRealParent().addToUpdatingChildren(child);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
tm.createViewport = function() {
|
package/src/ColorUtil.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
function ColorUtil() {}
|
|
2
|
+
|
|
3
|
+
ColorUtil.colors = {
|
|
4
|
+
aliceblue : "#f0f8ff",
|
|
5
|
+
antiquewhite : "#faebd7",
|
|
6
|
+
aqua : "#00ffff",
|
|
7
|
+
aquamarine : "#7fffd4",
|
|
8
|
+
azure : "#f0ffff",
|
|
9
|
+
beige : "#f5f5dc",
|
|
10
|
+
bisque : "#ffe4c4",
|
|
11
|
+
black : "#000000",
|
|
12
|
+
blanchedalmond : "#ffebcd",
|
|
13
|
+
blue : "#0000ff",
|
|
14
|
+
blueviolet : "#8a2be2",
|
|
15
|
+
brown : "#a52a2a",
|
|
16
|
+
burlywood : "#deb887",
|
|
17
|
+
cadetblue : "#5f9ea0",
|
|
18
|
+
chartreuse : "#7fff00",
|
|
19
|
+
chocolate : "#d2691e",
|
|
20
|
+
coral : "#ff7f50",
|
|
21
|
+
cornflowerblue : "#6495ed",
|
|
22
|
+
cornsilk : "#fff8dc",
|
|
23
|
+
crimson : "#dc143c",
|
|
24
|
+
cyan : "#00ffff",
|
|
25
|
+
darkblue : "#00008b",
|
|
26
|
+
darkcyan : "#008b8b",
|
|
27
|
+
darkgoldenrod : "#b8860b",
|
|
28
|
+
darkgray : "#a9a9a9",
|
|
29
|
+
darkgreen : "#006400",
|
|
30
|
+
darkkhaki : "#bdb76b",
|
|
31
|
+
darkmagenta : "#8b008b",
|
|
32
|
+
darkolivegreen : "#556b2f",
|
|
33
|
+
darkorange : "#ff8c00",
|
|
34
|
+
darkorchid : "#9932cc",
|
|
35
|
+
darkred : "#8b0000",
|
|
36
|
+
darksalmon : "#e9967a",
|
|
37
|
+
darkseagreen : "#8fbc8f",
|
|
38
|
+
darkslateblue : "#483d8b",
|
|
39
|
+
darkslategray : "#2f4f4f",
|
|
40
|
+
darkturquoise : "#00ced1",
|
|
41
|
+
darkviolet : "#9400d3",
|
|
42
|
+
deeppink : "#ff1493",
|
|
43
|
+
deepskyblue : "#00bfff",
|
|
44
|
+
dimgray : "#696969",
|
|
45
|
+
dodgerblue : "#1e90ff",
|
|
46
|
+
firebrick : "#b22222",
|
|
47
|
+
floralwhite : "#fffaf0",
|
|
48
|
+
forestgreen : "#228b22",
|
|
49
|
+
fuchsia : "#ff00ff",
|
|
50
|
+
gainsboro : "#dcdcdc",
|
|
51
|
+
ghostwhite : "#f8f8ff",
|
|
52
|
+
gold : "#ffd700",
|
|
53
|
+
goldenrod : "#daa520",
|
|
54
|
+
gray : "#808080",
|
|
55
|
+
green : "#008000",
|
|
56
|
+
greenyellow : "#adff2f",
|
|
57
|
+
honeydew : "#f0fff0",
|
|
58
|
+
hotpink : "#ff69b4",
|
|
59
|
+
indianred : "#cd5c5c",
|
|
60
|
+
indigo : "#4b0082",
|
|
61
|
+
ivory : "#fffff0",
|
|
62
|
+
khaki : "#f0e68c",
|
|
63
|
+
lavender : "#e6e6fa",
|
|
64
|
+
lavenderblush : "#fff0f5",
|
|
65
|
+
lawngreen : "#7cfc00",
|
|
66
|
+
lemonchiffon : "#fffacd",
|
|
67
|
+
lightblue : "#add8e6",
|
|
68
|
+
lightcoral : "#f08080",
|
|
69
|
+
lightcyan : "#e0ffff",
|
|
70
|
+
lightgoldenrodyellow : "#fafad2",
|
|
71
|
+
lightgrey : "#d3d3d3",
|
|
72
|
+
lightgreen : "#90ee90",
|
|
73
|
+
lightpink : "#ffb6c1",
|
|
74
|
+
lightsalmon : "#ffa07a",
|
|
75
|
+
lightseagreen : "#20b2aa",
|
|
76
|
+
lightskyblue : "#87cefa",
|
|
77
|
+
lightslategray : "#778899",
|
|
78
|
+
lightsteelblue : "#b0c4de",
|
|
79
|
+
lightyellow : "#ffffe0",
|
|
80
|
+
lime : "#00ff00",
|
|
81
|
+
limegreen : "#32cd32",
|
|
82
|
+
linen : "#faf0e6",
|
|
83
|
+
magenta : "#ff00ff",
|
|
84
|
+
maroon : "#800000",
|
|
85
|
+
mediumaquamarine : "#66cdaa",
|
|
86
|
+
mediumblue : "#0000cd",
|
|
87
|
+
mediumorchid : "#ba55d3",
|
|
88
|
+
mediumpurple : "#9370d8",
|
|
89
|
+
mediumseagreen : "#3cb371",
|
|
90
|
+
mediumslateblue : "#7b68ee",
|
|
91
|
+
mediumspringgreen : "#00fa9a",
|
|
92
|
+
mediumturquoise : "#48d1cc",
|
|
93
|
+
mediumvioletred : "#c71585",
|
|
94
|
+
midnightblue : "#191970",
|
|
95
|
+
mintcream : "#f5fffa",
|
|
96
|
+
mistyrose : "#ffe4e1",
|
|
97
|
+
moccasin : "#ffe4b5",
|
|
98
|
+
navajowhite : "#ffdead",
|
|
99
|
+
navy : "#000080",
|
|
100
|
+
oldlace : "#fdf5e6",
|
|
101
|
+
olive : "#808000",
|
|
102
|
+
olivedrab : "#6b8e23",
|
|
103
|
+
orange : "#ffa500",
|
|
104
|
+
orangered : "#ff4500",
|
|
105
|
+
orchid : "#da70d6",
|
|
106
|
+
palegoldenrod : "#eee8aa",
|
|
107
|
+
palegreen : "#98fb98",
|
|
108
|
+
paleturquoise : "#afeeee",
|
|
109
|
+
palevioletred : "#d87093",
|
|
110
|
+
papayawhip : "#ffefd5",
|
|
111
|
+
peachpuff : "#ffdab9",
|
|
112
|
+
peru : "#cd853f",
|
|
113
|
+
pink : "#ffc0cb",
|
|
114
|
+
plum : "#dda0dd",
|
|
115
|
+
powderblue : "#b0e0e6",
|
|
116
|
+
purple : "#800080",
|
|
117
|
+
rebeccapurple : "#663399",
|
|
118
|
+
red : "#ff0000",
|
|
119
|
+
rosybrown : "#bc8f8f",
|
|
120
|
+
royalblue : "#4169e1",
|
|
121
|
+
saddlebrown : "#8b4513",
|
|
122
|
+
salmon : "#fa8072",
|
|
123
|
+
sandybrown : "#f4a460",
|
|
124
|
+
seagreen : "#2e8b57",
|
|
125
|
+
seashell : "#fff5ee",
|
|
126
|
+
sienna : "#a0522d",
|
|
127
|
+
silver : "#c0c0c0",
|
|
128
|
+
skyblue : "#87ceeb",
|
|
129
|
+
slateblue : "#6a5acd",
|
|
130
|
+
slategray : "#708090",
|
|
131
|
+
snow : "#fffafa",
|
|
132
|
+
springgreen : "#00ff7f",
|
|
133
|
+
steelblue : "#4682b4",
|
|
134
|
+
tan : "#d2b48c",
|
|
135
|
+
teal : "#008080",
|
|
136
|
+
thistle : "#d8bfd8",
|
|
137
|
+
tomato : "#ff6347",
|
|
138
|
+
turquoise : "#40e0d0",
|
|
139
|
+
violet : "#ee82ee",
|
|
140
|
+
wheat : "#f5deb3",
|
|
141
|
+
white : "#ffffff",
|
|
142
|
+
whitesmoke : "#f5f5f5",
|
|
143
|
+
yellow : "#ffff00",
|
|
144
|
+
yellowgreen : "#9acd32"
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
ColorUtil.color2Integers = function(color) {
|
|
148
|
+
color = color ? color + '' : '';
|
|
149
|
+
color = ColorUtil.colors[color.toLowerCase()] ? ColorUtil.colors[color.toLowerCase()] : color;
|
|
150
|
+
|
|
151
|
+
if (!color) return;
|
|
152
|
+
|
|
153
|
+
if (color.startsWith('#')) {
|
|
154
|
+
color = color.slice(1);
|
|
155
|
+
color = color.length === 3 ? color = color.split('').map(function(char) { return char + char; }).join('') : color;
|
|
156
|
+
var bigint = parseInt(color, 16);
|
|
157
|
+
return [(bigint >> 16) & 255, (bigint >> 8) & 255, bigint & 255];
|
|
158
|
+
} else {
|
|
159
|
+
var rgbArray = color.match(/\d+/g);
|
|
160
|
+
return rgbArray && rgbArray.length === 3 ? rgbArray.map(Number) : undefined;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export { ColorUtil };
|
package/src/Easing.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function Easing() {}
|
|
2
|
+
|
|
3
|
+
Easing.linear =function (t) {
|
|
4
|
+
return t;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
Easing.inQuad = function (t) {
|
|
8
|
+
return t * t;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
Easing.outQuad = function(t) {
|
|
12
|
+
return t * (2 - t);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Easing.outExpo = function (t) {
|
|
16
|
+
return 1 - (1 - t) * (1 - t);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
Easing.circular = function (t) {
|
|
20
|
+
return Math.sqrt(1 - (--t * t));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Easing.inOutQuad = function (t) {
|
|
24
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
Easing.inOut = function (t) {
|
|
28
|
+
return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Easing.outElastic = function(t) {
|
|
32
|
+
var c4 = (2 * Math.PI) / 3;
|
|
33
|
+
|
|
34
|
+
return t === 0
|
|
35
|
+
? 0
|
|
36
|
+
: t === 1
|
|
37
|
+
? 1
|
|
38
|
+
: Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { Easing };
|
package/src/EventListener.js
CHANGED
|
@@ -107,12 +107,14 @@ EventListener.prototype.captureEvents = function() {
|
|
|
107
107
|
if (lastEvent.eventName === 'resize') {
|
|
108
108
|
tapp.dim.measureScreen();
|
|
109
109
|
} else {
|
|
110
|
-
|
|
110
|
+
if (lastEvent.tmodel) {
|
|
111
|
+
this.findEventHandlers(lastEvent.tmodel);
|
|
112
|
+
}
|
|
111
113
|
this.currentEvent = lastEvent.eventName;
|
|
112
114
|
this.currentKey = this.currentTouch.key;
|
|
113
115
|
this.currentTouch.key = "";
|
|
114
116
|
}
|
|
115
|
-
|
|
117
|
+
|
|
116
118
|
tapp.manager.scheduleRun(10, 'captureEvents' + '-' + lastEvent);
|
|
117
119
|
|
|
118
120
|
};
|
|
@@ -136,7 +138,7 @@ EventListener.prototype.handleEvent = function (event) {
|
|
|
136
138
|
this.touchTimeStamp = now > this.touchTimeStamp ? now : this.touchTimeStamp;
|
|
137
139
|
|
|
138
140
|
var tmodel = this.getTModelFromEvent(event);
|
|
139
|
-
|
|
141
|
+
|
|
140
142
|
var lastEvent = this.eventQueue.length > 0 ? this.eventQueue[this.eventQueue.length - 1] : null;
|
|
141
143
|
|
|
142
144
|
if (lastEvent) {
|
|
@@ -232,8 +234,8 @@ EventListener.prototype.handleEvent = function (event) {
|
|
|
232
234
|
EventListener.prototype.findEventHandlers = function(tmodel) {
|
|
233
235
|
|
|
234
236
|
var touchHandler = tmodel ? SearchUtil.findFirstTouchHandler(tmodel) : null;
|
|
235
|
-
var scrollLeftHandler = tmodel ? SearchUtil.findFirstScrollLeftHandler(tmodel) : null;
|
|
236
|
-
var scrollTopHandler = tmodel ? SearchUtil.findFirstScrollTopHandler(tmodel) : null;
|
|
237
|
+
var scrollLeftHandler = this.end0 ? this.currentHandlers.scrollLeft : tmodel ? SearchUtil.findFirstScrollLeftHandler(tmodel) : null;
|
|
238
|
+
var scrollTopHandler = this.end0 ? this.currentHandlers.scrollTop : tmodel ? SearchUtil.findFirstScrollTopHandler(tmodel) : null;
|
|
237
239
|
var pinchHandler = tmodel ? SearchUtil.findFirstPinchHandler(tmodel) : null;
|
|
238
240
|
|
|
239
241
|
if (this.currentHandlers.scrollLeft !== scrollLeftHandler || this.currentHandlers.scrollTop !== scrollTopHandler) {
|
|
@@ -384,8 +386,20 @@ EventListener.prototype.isClickHandlerType = function(type) {
|
|
|
384
386
|
return this.getTouchHandlerType() === type && this.isClickEvent();
|
|
385
387
|
};
|
|
386
388
|
|
|
387
|
-
EventListener.prototype.isTouchHandler = function(
|
|
388
|
-
return this.getTouchHandler() ===
|
|
389
|
+
EventListener.prototype.isTouchHandler = function(handler) {
|
|
390
|
+
return this.getTouchHandler() === handler;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
EventListener.prototype.isScrollLeftHandler = function(handler) {
|
|
394
|
+
return this.currentHandlers.scrollLeft === handler;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
EventListener.prototype.isScrollTopHandler = function(handler) {
|
|
398
|
+
return this.currentHandlers.scrollTop === handler;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
EventListener.prototype.isPinchHandler = function(handler) {
|
|
402
|
+
return this.currentHandlers.pinch === handler;
|
|
389
403
|
};
|
|
390
404
|
|
|
391
405
|
EventListener.prototype.isCurrentSource = function(source) {
|
|
@@ -410,18 +424,6 @@ EventListener.prototype.isTouchHandlerOrAncestor = function(target) {
|
|
|
410
424
|
return false;
|
|
411
425
|
};
|
|
412
426
|
|
|
413
|
-
EventListener.prototype.isScrollLeftHandler = function(handler) {
|
|
414
|
-
return this.currentHandlers.scrollLeft === handler;
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
EventListener.prototype.isScrollTopHandler = function(handler) {
|
|
418
|
-
return this.currentHandlers.scrollTop === handler;
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
EventListener.prototype.isPinchHandler = function(handler) {
|
|
422
|
-
return this.currentHandlers.pinch === handler;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
427
|
EventListener.prototype.countTouches = function(event) {
|
|
426
428
|
var count = event.touches && event.touches.length ? event.touches.length :
|
|
427
429
|
event.originalEvent && event.originalEvent.touches && event.originalEvent.touches.length ? event.originalEvent.touches.length : 1;
|
package/src/LocationManager.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Bracket } from "./Bracket.js";
|
|
2
2
|
import { TUtil } from "./TUtil.js";
|
|
3
3
|
import { TargetUtil } from "./TargetUtil.js";
|
|
4
|
+
import { TargetExecutor } from "./TargetExecutor.js";
|
|
4
5
|
import { tapp, getEvents, getScreenWidth, getScreenHeight } from "./App.js";
|
|
5
6
|
import { browser } from "./Browser.js";
|
|
6
7
|
|
|
@@ -56,14 +57,18 @@ LocationManager.prototype.calculateContainer = function(container) {
|
|
|
56
57
|
|
|
57
58
|
var viewport = container.createViewport();
|
|
58
59
|
container.resetVisibleList();
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
var i = 0, length = allChildren.length;
|
|
61
|
-
|
|
62
|
+
|
|
62
63
|
while (i < length && tapp.isRunning()) {
|
|
63
64
|
|
|
64
65
|
var child = allChildren[i++];
|
|
65
|
-
|
|
66
|
+
if (!child) continue;
|
|
67
|
+
|
|
66
68
|
var outerXEast = undefined, innerXEast = undefined;
|
|
69
|
+
|
|
70
|
+
var preX = child.domValues.x;
|
|
71
|
+
var preY = child.domValues.y;
|
|
67
72
|
|
|
68
73
|
this.calculateTargets(child);
|
|
69
74
|
|
|
@@ -75,8 +80,8 @@ LocationManager.prototype.calculateContainer = function(container) {
|
|
|
75
80
|
child.setLocation(viewport);
|
|
76
81
|
child.calculateAbsolutePosition(child.x, child.y);
|
|
77
82
|
|
|
78
|
-
innerXEast = TUtil.isDefined(container.
|
|
79
|
-
outerXEast = TUtil.isDefined(child.
|
|
83
|
+
innerXEast = TUtil.isDefined(container.val('innerXEast')) ? container.val('innerXEast') : container.getInnerXEast();
|
|
84
|
+
outerXEast = TUtil.isDefined(child.val('outerXEast')) ? child.val('outerXEast') : child.getOuterXEast();
|
|
80
85
|
|
|
81
86
|
if (viewport.isOverflow(outerXEast, innerXEast)) {
|
|
82
87
|
viewport.overflow();
|
|
@@ -89,87 +94,132 @@ LocationManager.prototype.calculateContainer = function(container) {
|
|
|
89
94
|
this.addToLocationList(child);
|
|
90
95
|
}
|
|
91
96
|
|
|
92
|
-
if (!child.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
child.setValue('x', child.x);
|
|
98
|
-
}
|
|
97
|
+
if (child.isTargetEnabled('x') && !child.isTargetUpdating('x') && !child.isTargetImperative('x') && child.getTargetSteps('x') === 0) {
|
|
98
|
+
TargetExecutor.resolveTargetValue(child, 'x');
|
|
99
|
+
TargetExecutor.snapActualToTarget(child, 'x');
|
|
100
|
+
} else if (!TUtil.isDefined(child.targetValues.x)) {
|
|
101
|
+
child.val('x', child.x);
|
|
99
102
|
}
|
|
100
103
|
|
|
101
|
-
if (!child.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
child.setValue('y', child.y);
|
|
107
|
-
}
|
|
104
|
+
if (child.isTargetEnabled('y') && !child.isTargetUpdating('y') && !child.isTargetImperative('y') && child.getTargetSteps('y') === 0) {
|
|
105
|
+
TargetExecutor.resolveTargetValue(child, 'y');
|
|
106
|
+
TargetExecutor.snapActualToTarget(child, 'y');
|
|
107
|
+
} else if (!TUtil.isDefined(child.targetValues.y)) {
|
|
108
|
+
child.val('y', child.y);
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
if (preX !== child.getX() || preY !== child.getY()) {
|
|
112
|
+
child.addToStyleTargetList('transform');
|
|
113
|
+
}
|
|
114
|
+
|
|
110
115
|
child.calculateAbsolutePosition(child.getX(), child.getY());
|
|
111
116
|
|
|
112
117
|
viewport.isVisible(child);
|
|
113
|
-
|
|
118
|
+
|
|
114
119
|
child.addToParentVisibleList();
|
|
115
|
-
|
|
120
|
+
|
|
116
121
|
if (child.shouldCalculateChildren()) {
|
|
117
122
|
this.calculateContainer(child);
|
|
118
123
|
}
|
|
119
|
-
|
|
120
|
-
if (child.isVisible() && child.isIncluded() && (child.targetUpdatingList.length > 0 || child.updatingChildren.length > 0)) {
|
|
121
|
-
container.addUpdatingChild(child);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
+
|
|
124
125
|
if (child.isInFlow()) {
|
|
125
|
-
var childLastHeight = child.getHeight();
|
|
126
|
-
|
|
127
|
-
if (child.hasChildren()) {
|
|
128
|
-
if (child.isTargetEnabled('width')) {
|
|
129
|
-
TargetUtil.assignValueArray(child, 'width');
|
|
130
|
-
tapp.targetManager.setJustActualValue(child, 'width');
|
|
131
|
-
}
|
|
132
|
-
if (child.isTargetEnabled('height')) {
|
|
133
|
-
TargetUtil.assignValueArray(child, 'height');
|
|
134
|
-
tapp.targetManager.setJustActualValue(child, 'height');
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (child.getHeight() !== childLastHeight && getEvents().isScrollTopHandler(child.getParent())
|
|
139
|
-
&& getEvents().dir() === 'up') {
|
|
140
|
-
this.calculateContainer(child);
|
|
141
|
-
}
|
|
142
126
|
|
|
143
|
-
if (TUtil.isNumber(child.
|
|
127
|
+
if (TUtil.isNumber(child.val('appendNewLine'))) {
|
|
144
128
|
viewport.appendNewLine();
|
|
129
|
+
viewport.calcContentWidthHeight();
|
|
145
130
|
} else {
|
|
146
|
-
viewport.
|
|
131
|
+
viewport.calcContentWidthHeight();
|
|
132
|
+
viewport.nextLocation();
|
|
147
133
|
}
|
|
148
134
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
135
|
+
|
|
136
|
+
if (Array.isArray(child.val('contentHeight'))) {
|
|
137
|
+
child.val('contentHeight').forEach(function(key) {
|
|
138
|
+
var preVal = child.val(key);
|
|
139
|
+
child.val(key, child.getContentHeight());
|
|
140
|
+
if (preVal !== child.val(key)) child.addToStyleTargetList(key);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
152
143
|
|
|
153
|
-
|
|
144
|
+
if (Array.isArray(child.val('contentWidth'))) {
|
|
145
|
+
child.val('contentWidth').forEach(function(key) {
|
|
146
|
+
var preVal = child.val(key);
|
|
147
|
+
child.val(key, child.getContentWidth());
|
|
148
|
+
if (preVal !== child.val(key)) child.addToStyleTargetList(key);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
viewport.calcContentWidthHeight();
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
this.locationCount.push(child.oid + "-" + child.updatingTargetList.length + "-" + (browser.now() - this.startTime));
|
|
156
|
+
}
|
|
157
|
+
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
LocationManager.prototype.calculateTargets = function(tmodel) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (tmodel.targets[key] && !tmodel.targets[key] !== 'number' && tmodel.targetValues[key] && !tmodel.isTargetActive(key)) {
|
|
160
|
-
tmodel.activeTargetMap[key] = true;
|
|
161
|
-
tmodel.targetValues[key].status = '';
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
tapp.targetManager.setTargetValues(tmodel, Object.keys(tmodel.activeTargetMap));
|
|
161
|
+
this.resetTargetsOnEvents(tmodel);
|
|
162
|
+
tapp.targetManager.applyTargetValues(tmodel);
|
|
167
163
|
tapp.targetManager.setActualValues(tmodel);
|
|
168
164
|
|
|
169
165
|
if (tmodel.hasDom()) {
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
var preWidth = tmodel.getWidth();
|
|
167
|
+
var preHeight = tmodel.getHeight();
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
if ((!TUtil.isDefined(tmodel.targetValues.width) && !TUtil.isDefined(tmodel.targets.width) && !TUtil.isDefined(tmodel.targetValues.contentWidth)) || tmodel.getTargetValue('widthFromDom')) {
|
|
171
|
+
TargetUtil.setWidthFromDom(tmodel);
|
|
172
|
+
}
|
|
173
|
+
if ((!TUtil.isDefined(tmodel.targetValues.height) && !TUtil.isDefined(tmodel.targets.height) && !TUtil.isDefined(tmodel.targetValues.contentHeight)) || tmodel.getTargetValue('heightFromDom')) {
|
|
174
|
+
TargetUtil.setHeightFromDom(tmodel);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (preWidth !== tmodel.getWidth() || preHeight !== tmodel.getHeight()) {
|
|
178
|
+
tmodel.addToStyleTargetList('dim');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
LocationManager.prototype.resetTargetsOnEvents = function(tmodel) {
|
|
184
|
+
var resetTargets = [];
|
|
185
|
+
|
|
186
|
+
if (this.resizeFlag && tmodel.targets['onResize']) {
|
|
187
|
+
resetTargets = resetTargets.concat(tmodel.targets['onResize']);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (getEvents().isTouchHandler(tmodel) && tmodel.targets['onTouchEvent']) {
|
|
191
|
+
resetTargets = resetTargets.concat(tmodel.targets['onTouchEvent']);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (getEvents().isClickHandler(tmodel) && tmodel.targets['onClickEvent']) {
|
|
195
|
+
resetTargets = resetTargets.concat(tmodel.targets['onClickEvent']);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if ((getEvents().isScrollLeftHandler(tmodel) && getEvents().deltaX())
|
|
199
|
+
|| (getEvents().isScrollTopHandler(tmodel) && getEvents().deltaY())) {
|
|
200
|
+
if (tmodel.targets['onScrollEvent']) {
|
|
201
|
+
resetTargets = resetTargets.concat(tmodel.targets['onScrollEvent']);
|
|
202
|
+
}
|
|
172
203
|
}
|
|
204
|
+
|
|
205
|
+
if (TargetJ.getEvents().currentKey && tmodel.targets['onKeyEvent']) {
|
|
206
|
+
resetTargets = resetTargets.concat(tmodel.targets['onKeyEvent']);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
resetTargets.forEach(function(target) {
|
|
210
|
+
var key, obj;
|
|
211
|
+
if (typeof target === 'object') {
|
|
212
|
+
key = target.key;
|
|
213
|
+
obj = target.object || tmodel;
|
|
214
|
+
} else {
|
|
215
|
+
key = target;
|
|
216
|
+
obj = tmodel;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (obj.targets[key] && obj.isTargetComplete(key)) {
|
|
220
|
+
obj.resetTarget(key);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
173
223
|
};
|
|
174
224
|
|
|
175
225
|
LocationManager.prototype.addToLocationList = function(child) {
|
package/src/Moves.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Easing } from "./Easing.js";
|
|
2
|
+
|
|
3
|
+
function Moves() {}
|
|
4
|
+
|
|
5
|
+
Moves.bounce = function (from, to, bounceFactor) {
|
|
6
|
+
bounceFactor = bounceFactor || 0.6;
|
|
7
|
+
|
|
8
|
+
var bounce = to * bounceFactor;
|
|
9
|
+
var moves = [from];
|
|
10
|
+
while ((bounce | 0) > 1) {
|
|
11
|
+
moves.push(to);
|
|
12
|
+
moves.push(to - bounce);
|
|
13
|
+
bounce *= 0.5;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return moves;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
Moves.spiral = function (startAngle, endAngle, angleStep, x, y, width, height) {
|
|
20
|
+
|
|
21
|
+
var xCoords = [], yCoords = [], rotations = [];
|
|
22
|
+
|
|
23
|
+
for (var angle = startAngle; angle <= endAngle; angle += angleStep) {
|
|
24
|
+
var radians = angle * (Math.PI / 180);
|
|
25
|
+
xCoords.push(Math.floor(x + width * Math.cos(radians)));
|
|
26
|
+
yCoords.push(Math.floor(y + height * Math.sin(radians)));
|
|
27
|
+
rotations.push(90 + angle);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return { x: xCoords, y: yCoords, rotate: rotations };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export { Moves };
|