targetj 1.0.74 → 1.0.76
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/babel.config.json +17 -0
- package/build/$Dom.js +424 -0
- package/build/App.js +187 -0
- package/build/Bracket.js +157 -0
- package/build/BracketGenerator.js +86 -0
- package/build/Browser.js +105 -0
- package/build/ColorUtil.js +182 -0
- package/build/Dim.js +31 -0
- package/build/Easing.js +59 -0
- package/build/EventListener.js +664 -0
- package/build/LoadingManager.js +366 -0
- package/build/LocationManager.js +211 -0
- package/build/Moves.js +71 -0
- package/build/PageManager.js +113 -0
- package/build/SearchUtil.js +196 -0
- package/build/TModel.js +1000 -0
- package/build/TModelManager.js +605 -0
- package/build/TUtil.js +188 -0
- package/build/TargetExecutor.js +117 -0
- package/build/TargetManager.js +197 -0
- package/build/TargetUtil.js +299 -0
- package/build/Viewport.js +163 -0
- package/package.json +11 -4
- package/webpack.config.js +14 -1
- package/src/$Dom.js +0 -380
- package/src/App.js +0 -224
- package/src/Bracket.js +0 -212
- package/src/Browser.js +0 -122
- package/src/ColorUtil.js +0 -166
- package/src/Dim.js +0 -21
- package/src/Easing.js +0 -41
- package/src/EventListener.js +0 -570
- package/src/LoadingManager.js +0 -368
- package/src/LocationManager.js +0 -236
- package/src/Moves.js +0 -59
- package/src/PageManager.js +0 -87
- package/src/SearchUtil.js +0 -210
- package/src/TModel.js +0 -937
- package/src/TModelManager.js +0 -575
- package/src/TUtil.js +0 -162
- package/src/TargetExecutor.js +0 -113
- package/src/TargetManager.js +0 -191
- package/src/TargetUtil.js +0 -307
- package/src/Viewport.js +0 -180
package/src/TargetUtil.js
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import { browser } from "./Browser.js";
|
|
2
|
-
import { TModel } from "./TModel.js";
|
|
3
|
-
import { getManager } from "./App.js";
|
|
4
|
-
import { TUtil } from "./TUtil.js";
|
|
5
|
-
import { ColorUtil } from "./ColorUtil.js";
|
|
6
|
-
|
|
7
|
-
function TargetUtil() {}
|
|
8
|
-
|
|
9
|
-
TargetUtil.styleTargetMap = {
|
|
10
|
-
x: true,
|
|
11
|
-
y: true,
|
|
12
|
-
width: true,
|
|
13
|
-
height: true,
|
|
14
|
-
rotate: true,
|
|
15
|
-
scale: true,
|
|
16
|
-
opacity: true,
|
|
17
|
-
zIndex: true,
|
|
18
|
-
fontSize: true,
|
|
19
|
-
lineHeight: true,
|
|
20
|
-
borderRadius: true,
|
|
21
|
-
padding: true,
|
|
22
|
-
backgroundColor: true,
|
|
23
|
-
background: true,
|
|
24
|
-
color: true,
|
|
25
|
-
css: true,
|
|
26
|
-
style: true,
|
|
27
|
-
transform: true,
|
|
28
|
-
dim: true
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
TargetUtil.transformMap = {
|
|
32
|
-
x: true,
|
|
33
|
-
y: true,
|
|
34
|
-
rotate: true,
|
|
35
|
-
scale: true
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
TargetUtil.dimMap = {
|
|
39
|
-
width: true,
|
|
40
|
-
height: true
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
TargetUtil.colorMap = {
|
|
44
|
-
color: true,
|
|
45
|
-
background: true,
|
|
46
|
-
backgroundColor: true
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
TargetUtil.emptyValue = function() {
|
|
50
|
-
return {
|
|
51
|
-
value: undefined,
|
|
52
|
-
step: 0,
|
|
53
|
-
steps: 0,
|
|
54
|
-
cycle: 0,
|
|
55
|
-
cycles: 0,
|
|
56
|
-
interval: 0,
|
|
57
|
-
initialValue: undefined,
|
|
58
|
-
scheduleTimeStamp: undefined,
|
|
59
|
-
actualValueLastUpdate: 0,
|
|
60
|
-
status: '',
|
|
61
|
-
executionCount: 0,
|
|
62
|
-
executionFlag: false,
|
|
63
|
-
isImperative: false,
|
|
64
|
-
originalTargetName: undefined,
|
|
65
|
-
easing: undefined,
|
|
66
|
-
creationTime: browser.now()
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
TargetUtil.bindTargetName = function(targetInstance, key) {
|
|
71
|
-
var target = targetInstance[key];
|
|
72
|
-
|
|
73
|
-
if (typeof target === 'object') {
|
|
74
|
-
['value', 'enabledOn', 'onStepsEnd', 'onValueChange', 'loop', 'onImperativeEnd', 'onImperativeStep'].forEach(function(method) {
|
|
75
|
-
if (typeof target[method] === 'function') {
|
|
76
|
-
var originalMethod = target[method];
|
|
77
|
-
target[method] = function() {
|
|
78
|
-
this.key = key;
|
|
79
|
-
return originalMethod.apply(this, arguments);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
} else if (typeof target === 'function') {
|
|
84
|
-
var originalFunction = target;
|
|
85
|
-
targetInstance[key] = function() {
|
|
86
|
-
this.key = key; // Assign the key to `this`
|
|
87
|
-
return originalFunction.apply(this, arguments); // Call the original function
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
TargetUtil.isValueStepsCycleArray = function(arr) {
|
|
93
|
-
if (arr.length > 4 || arr.length === 0) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
var result = arr.length >= 2;
|
|
98
|
-
for (var i = 1; i < arr.length; i++) {
|
|
99
|
-
if (typeof arr[i] !== 'number') {
|
|
100
|
-
result = false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return result && (typeof arr[0] === 'number' || TargetUtil.isListTarget(arr[0]) || typeof arr[0] === 'string') ? true : false;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
TargetUtil.isListTarget = function(value) {
|
|
108
|
-
return typeof value === 'object' && Array.isArray(value.list);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
TargetUtil.isAddChildTarget = function(key, value) {
|
|
112
|
-
return value instanceof TModel && key === 'addChild';
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
TargetUtil.getValueStepsCycles = function(tmodel, key) {
|
|
116
|
-
var _target = tmodel.targets[key];
|
|
117
|
-
var valueOnly = _target && _target.valueOnly ? true : false;
|
|
118
|
-
var cycle = tmodel.getTargetCycle(key);
|
|
119
|
-
var lastValue = tmodel.val(key);
|
|
120
|
-
|
|
121
|
-
var value = null, steps = 0, interval = 0, cycles = 0;
|
|
122
|
-
|
|
123
|
-
function getValue(target) {
|
|
124
|
-
if (Array.isArray(target)) {
|
|
125
|
-
if (valueOnly || !TargetUtil.isValueStepsCycleArray(target)) {
|
|
126
|
-
return [target, steps, interval, cycles];
|
|
127
|
-
} else if (Array.isArray(_target)) {
|
|
128
|
-
return _target;
|
|
129
|
-
} else {
|
|
130
|
-
value = target[0];
|
|
131
|
-
steps = target.length >= 2 ? target[1] : steps;
|
|
132
|
-
interval = target.length >= 3 ? target[2] : interval;
|
|
133
|
-
cycles = target.length >= 4 ? target[3] : cycles;
|
|
134
|
-
|
|
135
|
-
return [value, steps, interval, cycles];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (typeof target === 'object' && target !== null) {
|
|
140
|
-
value = typeof target.value === 'function' ? target.value.call(tmodel, cycle, lastValue) : TUtil.isDefined(target.value) ? target.value : target;
|
|
141
|
-
steps = typeof target.steps === 'function' ? target.steps.call(tmodel, cycle) : TUtil.isDefined(target.steps) ? target.steps : 0;
|
|
142
|
-
interval = typeof target.interval === 'function' ? target.interval.call(tmodel, cycle) : TUtil.isDefined(target.interval) ? target.interval : 0;
|
|
143
|
-
cycles = typeof target.cycles === 'function' ? target.cycles.call(tmodel, cycle, tmodel.getTargetCycles(key)) : TUtil.isDefined(target.cycles) ? target.cycles : 0;
|
|
144
|
-
|
|
145
|
-
return Array.isArray(value) ? getValue(value) : [value, steps, interval, cycles];
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (typeof target === 'function') {
|
|
149
|
-
return getValue(target.call(tmodel, cycle, lastValue));
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return [target, steps, interval, cycles];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return getValue(_target);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
TargetUtil.getIntervalValue = function(tmodel, key, interval) {
|
|
159
|
-
var intervalValue = typeof interval === 'function' ? interval.call(tmodel, key) : interval;
|
|
160
|
-
|
|
161
|
-
return TUtil.isNumber(intervalValue) ? intervalValue : 0;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
TargetUtil.scheduleExecution = function(tmodel, key) {
|
|
165
|
-
var now = browser.now();
|
|
166
|
-
var interval = tmodel.getTargetInterval(key);
|
|
167
|
-
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
168
|
-
|
|
169
|
-
var schedulePeriod = 0;
|
|
170
|
-
|
|
171
|
-
if (interval > 0) {
|
|
172
|
-
if (TUtil.isDefined(lastScheduledTime)) {
|
|
173
|
-
var elapsed = now - lastScheduledTime;
|
|
174
|
-
schedulePeriod = Math.max(interval - elapsed, 0);
|
|
175
|
-
} else {
|
|
176
|
-
schedulePeriod = interval;
|
|
177
|
-
tmodel.setScheduleTimeStamp(key, now); // Set the schedule timestamp when first scheduled
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (schedulePeriod > 0 && !TUtil.isDefined(lastScheduledTime)) {
|
|
182
|
-
tmodel.setScheduleTimeStamp(key, now);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return schedulePeriod;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
TargetUtil.getTargetSchedulePeriod = function(tmodel, key, intervalValue) {
|
|
189
|
-
|
|
190
|
-
var now = browser.now();
|
|
191
|
-
var pastPeriod;
|
|
192
|
-
var schedulePeriod = 0;
|
|
193
|
-
|
|
194
|
-
if (intervalValue > 0) {
|
|
195
|
-
if (TUtil.isDefined(tmodel.getTargetTimeStamp(key))) {
|
|
196
|
-
pastPeriod = now - tmodel.getTargetTimeStamp(key);
|
|
197
|
-
if (pastPeriod < intervalValue) {
|
|
198
|
-
schedulePeriod = intervalValue - pastPeriod;
|
|
199
|
-
} else {
|
|
200
|
-
schedulePeriod = 0;
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
tmodel.setTargetTimeStamp(key, now);
|
|
204
|
-
schedulePeriod = intervalValue;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
} else if (TUtil.isDefined(tmodel.getTargetTimeStamp(key))) {
|
|
208
|
-
pastPeriod = now - tmodel.getTargetTimeStamp(key);
|
|
209
|
-
if (pastPeriod < 0) {
|
|
210
|
-
schedulePeriod = -pastPeriod;
|
|
211
|
-
} else {
|
|
212
|
-
schedulePeriod = 0;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return schedulePeriod;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
TargetUtil.handleValueChange = function(tmodel, key, newValue, lastValue, step, cycle) {
|
|
220
|
-
if (typeof tmodel.targets[key] === 'object' && typeof tmodel.targets[key].onValueChange === 'function') {
|
|
221
|
-
|
|
222
|
-
var valueChanged = !TUtil.areEqual(newValue, lastValue, tmodel.targets[key].deepEquality);
|
|
223
|
-
if (valueChanged) {
|
|
224
|
-
tmodel.targets[key].onValueChange.call(tmodel, newValue, lastValue, cycle);
|
|
225
|
-
tmodel.setTargetMethodName(key, 'onValueChange');
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
TargetUtil.morph = function(tmodel, key, fromValue, toValue, step) {
|
|
231
|
-
|
|
232
|
-
var easing = tmodel.getTargetEasing(key);
|
|
233
|
-
var easingStep = easing ? easing(tmodel.getTargetStepPercent(key, step)) : tmodel.getTargetStepPercent(key, step);
|
|
234
|
-
|
|
235
|
-
if (TargetUtil.colorMap[key]) {
|
|
236
|
-
|
|
237
|
-
var targetColors = ColorUtil.color2Integers(toValue);
|
|
238
|
-
var lastColors = fromValue ? ColorUtil.color2Integers(fromValue) : ColorUtil.color2Integers('#fff');
|
|
239
|
-
|
|
240
|
-
if (targetColors && lastColors) {
|
|
241
|
-
var red = Math.floor(targetColors[0] * easingStep + lastColors[0] * (1 - easingStep));
|
|
242
|
-
var green = Math.floor(targetColors[1] * easingStep + lastColors[1] * (1 - easingStep));
|
|
243
|
-
var blue = Math.floor(targetColors[2] * easingStep + lastColors[2] * (1 - easingStep));
|
|
244
|
-
|
|
245
|
-
return 'rgb(' + red + ',' + green + ',' + blue + ')';
|
|
246
|
-
} else {
|
|
247
|
-
return toValue;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
} else {
|
|
251
|
-
return typeof toValue === 'number' ? toValue * easingStep + fromValue * (1 - easingStep) : toValue;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
TargetUtil.setWidthFromDom = function(child) {
|
|
256
|
-
var height = TUtil.isDefined(child.domWidth) ? child.domWidth.height : undefined;
|
|
257
|
-
var width = TUtil.isDefined(child.domWidth) ? child.domWidth.width : undefined;
|
|
258
|
-
var domParent = child.getDomParent();
|
|
259
|
-
var rerender = false;
|
|
260
|
-
|
|
261
|
-
if (getManager().needsRerender(child)) {
|
|
262
|
-
child.isTextOnly() ? child.$dom.text(child.getHtml()) : child.$dom.html(child.getHtml());
|
|
263
|
-
rerender = true;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (!TUtil.isDefined(child.domWidth)
|
|
267
|
-
|| rerender
|
|
268
|
-
|| height !== child.getHeight()
|
|
269
|
-
|| (domParent && child.getActualValueLastUpdate('width') <= domParent.getActualValueLastUpdate('width'))) {
|
|
270
|
-
child.$dom.width('auto');
|
|
271
|
-
width = child.$dom.width();
|
|
272
|
-
height = child.$dom.height();
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
child.domWidth = { width: width, height: height };
|
|
276
|
-
child.val('width', width);
|
|
277
|
-
|
|
278
|
-
return width;
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
TargetUtil.setHeightFromDom = function(child) {
|
|
282
|
-
var height = TUtil.isDefined(child.domHeight) ? child.domHeight.height : undefined;
|
|
283
|
-
var width = TUtil.isDefined(child.domHeight) ? child.domHeight.width : undefined;
|
|
284
|
-
var domParent = child.getDomParent();
|
|
285
|
-
var rerender = false;
|
|
286
|
-
|
|
287
|
-
if (getManager().needsRerender(child)) {
|
|
288
|
-
child.isTextOnly() ? child.$dom.text(child.getHtml()) : child.$dom.html(child.getHtml());
|
|
289
|
-
rerender = true;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (!TUtil.isDefined(child.domHeight)
|
|
293
|
-
|| rerender
|
|
294
|
-
|| width !== child.getWidth()
|
|
295
|
-
|| (domParent && child.getActualValueLastUpdate('height') <= domParent.getActualValueLastUpdate('height'))) {
|
|
296
|
-
child.$dom.height('auto');
|
|
297
|
-
width = child.$dom.width();
|
|
298
|
-
height = child.$dom.height();
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
child.domHeight = { height: height, width: width };
|
|
302
|
-
child.val('height', height);
|
|
303
|
-
|
|
304
|
-
return height;
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
export { TargetUtil };
|
package/src/Viewport.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { TUtil } from "./TUtil.js";
|
|
2
|
-
import { getScreenWidth, getScreenHeight } from "./App.js";
|
|
3
|
-
|
|
4
|
-
function Viewport(tmodel) {
|
|
5
|
-
|
|
6
|
-
this.tmodel = tmodel;
|
|
7
|
-
this.xNext = 0;
|
|
8
|
-
this.xNorth = 0;
|
|
9
|
-
this.xWest = 0;
|
|
10
|
-
this.xEast = 0;
|
|
11
|
-
this.xSouth = 0;
|
|
12
|
-
|
|
13
|
-
this.xOverflow = 0;
|
|
14
|
-
|
|
15
|
-
this.xOffset = 0;
|
|
16
|
-
|
|
17
|
-
this.yNext = 0;
|
|
18
|
-
this.yNorth = 0;
|
|
19
|
-
this.yWest = 0;
|
|
20
|
-
this.yEast = 0;
|
|
21
|
-
this.ySouth = 0;
|
|
22
|
-
|
|
23
|
-
this.yOffset = 0;
|
|
24
|
-
|
|
25
|
-
this.reset();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
Viewport.prototype.reset = function() {
|
|
29
|
-
var x, y;
|
|
30
|
-
if (this.tmodel.type === 'BI') {
|
|
31
|
-
x = this.tmodel.getX() + this.tmodel.getScrollLeft();
|
|
32
|
-
y = this.tmodel.getY() + this.tmodel.getScrollTop();
|
|
33
|
-
|
|
34
|
-
this.xOffset = 0;
|
|
35
|
-
this.yOffset = 0;
|
|
36
|
-
|
|
37
|
-
this.xNext = x;
|
|
38
|
-
this.xNorth = x;
|
|
39
|
-
this.xEast = x;
|
|
40
|
-
this.xSouth = x;
|
|
41
|
-
this.xWest = x;
|
|
42
|
-
|
|
43
|
-
this.xOverflow = this.tmodel.getRealParent().getX();
|
|
44
|
-
|
|
45
|
-
this.yNext = y;
|
|
46
|
-
this.yNorth = y;
|
|
47
|
-
this.yWest = y;
|
|
48
|
-
this.yEast = y;
|
|
49
|
-
this.ySouth = this.tmodel.getRealParent().viewport ? this.tmodel.getRealParent().viewport.ySouth : y;
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
this.xOffset = 0;
|
|
53
|
-
this.yOffset = 0;
|
|
54
|
-
|
|
55
|
-
x = this.tmodel.getX();
|
|
56
|
-
y = this.tmodel.getY();
|
|
57
|
-
|
|
58
|
-
this.xNext = x;
|
|
59
|
-
this.xNorth = x;
|
|
60
|
-
this.xEast = x;
|
|
61
|
-
this.xSouth = x;
|
|
62
|
-
this.xWest = x;
|
|
63
|
-
|
|
64
|
-
this.xOverflow = TUtil.isDefined(this.tmodel.val('xOverflow')) ? this.tmodel.val('xOverflow') : x;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.yNext = y;
|
|
68
|
-
this.yNorth = y;
|
|
69
|
-
this.yWest = y;
|
|
70
|
-
this.yEast = y;
|
|
71
|
-
this.ySouth = y;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return this;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Viewport.prototype.setCurrentChild = function(child) {
|
|
78
|
-
this.currentChild = child;
|
|
79
|
-
|
|
80
|
-
this.xOffset = child.getDomParent() ? -child.getDomParent().getX() : 0;
|
|
81
|
-
this.yOffset = child.getDomParent() ? -child.getDomParent().getY() : 0;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
Viewport.prototype.getXNext = function() {
|
|
85
|
-
return this.xNext + this.currentChild.getLeftMargin() + this.xOffset - this.tmodel.getScrollLeft();
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
Viewport.prototype.getYNext = function() {
|
|
89
|
-
return this.yNext + this.currentChild.getTopMargin() + this.yOffset - this.tmodel.getScrollTop();
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
Viewport.prototype.isVisible = function(child) {
|
|
93
|
-
|
|
94
|
-
var x = child.absX;
|
|
95
|
-
var y = child.absY;
|
|
96
|
-
|
|
97
|
-
var parentScale = child.getDomParent() ? child.getDomParent().getMeasuringScale() : 1;
|
|
98
|
-
var scale = parentScale * child.getMeasuringScale();
|
|
99
|
-
var maxWidth = TUtil.isDefined(child.getWidth()) ? scale * child.getWidth() : 0;
|
|
100
|
-
var maxHeight = TUtil.isDefined(child.getHeight()) ? scale * child.getHeight() : 0;
|
|
101
|
-
|
|
102
|
-
var status = child.visibilityStatus;
|
|
103
|
-
|
|
104
|
-
var rect = child.getBoundingRect();
|
|
105
|
-
|
|
106
|
-
if (!child.hasChildren()) {
|
|
107
|
-
status.right = x <= getScreenWidth() && x <= rect.right;
|
|
108
|
-
status.left = x + maxWidth >= 0 && x + maxWidth >= rect.left;
|
|
109
|
-
status.bottom = y <= getScreenHeight() && y <= rect.bottom;
|
|
110
|
-
status.top = y + maxHeight >= 0 && y + maxHeight >= rect.top;
|
|
111
|
-
} else {
|
|
112
|
-
status.right = x <= rect.right;
|
|
113
|
-
status.left = x + maxWidth >= rect.left;
|
|
114
|
-
status.bottom = y <= rect.bottom;
|
|
115
|
-
status.top = y + maxHeight >= rect.top;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
child.visible = status.left && status.right && status.top && status.bottom;
|
|
119
|
-
|
|
120
|
-
//browser.log(child.oid === 'num')("oid: " + child.oid + " in " + this.tmodel.oid + " min-maxX:" + Math.round(rect.left) + "-" + Math.round(rect.right) + " x:" + Math.round(x) + " w:" + Math.floor(maxWidth) + " sc:" + scale + " vx:" + child.xVisible);
|
|
121
|
-
//browser.log(child.oid === 'docsPanel')("oid: " + child.oid + " in " + this.tmodel.oid + " min-maxY:" + Math.round(rect.top) + "-" + Math.round(rect.bottom) + " y:" + Math.round(y) + " h:" + Math.floor(maxHeight) + " sc:" + scale + " vy:" + child.yVisible);
|
|
122
|
-
|
|
123
|
-
return child.isVisible();
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
Viewport.prototype.isOverflow = function(outerXEast, innerXEast) {
|
|
127
|
-
if (TUtil.isNumber(outerXEast) && TUtil.isNumber(innerXEast)) {
|
|
128
|
-
return outerXEast > innerXEast;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
Viewport.prototype.overflow = function() {
|
|
133
|
-
this.xNext = this.xOverflow;
|
|
134
|
-
this.yNext = this.ySouth;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
Viewport.prototype.appendNewLine = function() {
|
|
138
|
-
|
|
139
|
-
var innerHeight = this.currentChild.getInnerHeight() * this.currentChild.getMeasuringScale();
|
|
140
|
-
|
|
141
|
-
this.xNext = this.xOverflow;
|
|
142
|
-
this.yNext = this.ySouth > this.yNext ? this.ySouth + this.currentChild.val('appendNewLine') : this.ySouth + innerHeight + this.currentChild.val('appendNewLine');
|
|
143
|
-
|
|
144
|
-
this.yEast = this.yNext;
|
|
145
|
-
this.xSouth = this.xNext;
|
|
146
|
-
|
|
147
|
-
this.ySouth = Math.max(this.yNext, this.ySouth);
|
|
148
|
-
|
|
149
|
-
this.currentChild.getRealParent().viewport.xEast = Math.max(this.currentChild.getRealParent().viewport.xEast, this.xEast);
|
|
150
|
-
this.currentChild.getRealParent().viewport.ySouth = Math.max(this.currentChild.getRealParent().viewport.ySouth, this.ySouth);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
Viewport.prototype.nextLocation = function() {
|
|
154
|
-
|
|
155
|
-
var innerWidth = this.currentChild.getInnerWidth() * this.currentChild.getMeasuringScale();
|
|
156
|
-
var innerHeight = this.currentChild.getInnerHeight() * this.currentChild.getMeasuringScale();
|
|
157
|
-
var innerContentHeight = this.currentChild.getInnerContentHeight() * this.currentChild.getMeasuringScale();
|
|
158
|
-
|
|
159
|
-
var ySouth = this.yNext + innerHeight + this.currentChild.getTopMargin() + this.currentChild.getBottomMargin();
|
|
160
|
-
this.xNext += innerWidth + this.currentChild.getLeftMargin() + this.currentChild.getRightMargin();
|
|
161
|
-
this.yNext += innerContentHeight;
|
|
162
|
-
|
|
163
|
-
this.xSouth = this.xNext;
|
|
164
|
-
this.yEast = this.yNext;
|
|
165
|
-
|
|
166
|
-
this.xEast = Math.max(this.xNext, this.xEast);
|
|
167
|
-
this.ySouth = Math.max(ySouth, this.ySouth);
|
|
168
|
-
|
|
169
|
-
this.currentChild.getRealParent().viewport.xEast = Math.max(this.currentChild.getRealParent().viewport.xEast, this.xEast);
|
|
170
|
-
this.currentChild.getRealParent().viewport.ySouth = Math.max(this.currentChild.getRealParent().viewport.ySouth, this.ySouth);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
Viewport.prototype.calcContentWidthHeight = function() {
|
|
174
|
-
this.tmodel.contentHeight = this.ySouth - this.yNorth;
|
|
175
|
-
this.tmodel.innerContentHeight = this.yEast - this.yNorth;
|
|
176
|
-
this.tmodel.innerContentWidth = this.xSouth - this.xWest;
|
|
177
|
-
this.tmodel.contentWidth = this.xEast - this.xWest;
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export { Viewport };
|