targetj 1.0.49 → 1.0.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "targetj",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],
package/src/App.js CHANGED
@@ -110,7 +110,8 @@ function AppFn(uiFactory, rootId) {
110
110
  my.manager.lists.deletedTModel.length = 0;
111
111
  my.manager.lists.visibleNoDom.length = 0;
112
112
  my.manager.visibleTypeMap = {};
113
- my.manager.visibleOidMap = {};
113
+ my.manager.visibleOidMap = {};
114
+ my.manager.targetExecuteMap = {};
114
115
  my.locationManager.hasLocationList.length = 0;
115
116
  SearchUtil.foundParentWithTarget = {};
116
117
  SearchUtil.foundTypeMap = {};
package/src/Bracket.js CHANGED
@@ -11,21 +11,9 @@ function Bracket(parent) {
11
11
 
12
12
  tm.targets = {
13
13
  canHaveDom: false,
14
- innerXEast: {
15
- loop: true,
16
- value: function() {
17
- return TUtil.isDefined(tm.getRealParent().getValue('innerXEast')) ? tm.getRealParent().getValue('innerXEast') : tm.getRealParent().absX + tm.getRealParent().getWidth();
18
- }
19
- },
20
- xOverflow: {
21
- loop: true,
22
- value: function() {
23
- return this.getRealParent().getX();
24
- }
25
- },
26
14
  outerXEast: 0
27
15
  };
28
-
16
+
29
17
  tm.getWidth = function() {
30
18
  return this.getContentWidth();
31
19
  };
@@ -38,6 +26,10 @@ function Bracket(parent) {
38
26
  return this.innerContentWidth;
39
27
  };
40
28
 
29
+ tm.getInnerXEast = function() {
30
+ return TUtil.isDefined(tm.getRealParent().getValue('innerXEast')) ? this.getRealParent().getValue('innerXEast') : this.getRealParent().absX + this.getRealParent().getWidth();
31
+ };
32
+
41
33
  tm.getInnerContentHeight = function() {
42
34
  return this.innerContentHeight;
43
35
  };
@@ -74,8 +74,8 @@ LocationManager.prototype.calculateContainer = function(container) {
74
74
  viewport.setCurrentChild(child);
75
75
  child.setLocation(viewport);
76
76
 
77
- innerXEast = TUtil.isDefined(container.getValue('innerXEast')) ? container.getValue('innerXEast') : container.absX + container.getInnerWidth();
78
- outerXEast = TUtil.isDefined(child.getValue('outerXEast')) ? child.getValue('outerXEast') : child.absX + child.getInnerWidth();
77
+ innerXEast = TUtil.isDefined(container.getValue('innerXEast')) ? container.getValue('innerXEast') : container.getInnerXEast();
78
+ outerXEast = TUtil.isDefined(child.getValue('outerXEast')) ? child.getValue('outerXEast') : child.getOuterXEast();
79
79
 
80
80
  if (viewport.isOverflow(outerXEast, innerXEast)) {
81
81
  viewport.overflow();
package/src/TModel.js CHANGED
@@ -60,6 +60,8 @@ function TModel(type, targets) {
60
60
  this.targetUpdatingMap = {};
61
61
  this.targetUpdatingList = [];
62
62
 
63
+ this.targetExecuteMap = {};
64
+
63
65
  this.updatingChildren = [];
64
66
 
65
67
  this.targetLastUpdateMap = {};
@@ -226,6 +228,14 @@ TModel.prototype.getInnerWidth = function() {
226
228
  return TUtil.isDefined(this.actualValues.innerWidth) ? this.actualValues.innerWidth : this.getWidth();
227
229
  };
228
230
 
231
+ TModel.prototype.getInnerXEast = function() {
232
+ return this.absX + this.getInnerWidth();
233
+ };
234
+
235
+ TModel.prototype.getOuterXEast = function() {
236
+ return this.absX + this.getInnerWidth();
237
+ };
238
+
229
239
  TModel.prototype.getContentWidth = function() {
230
240
  return this.contentWidth;
231
241
  };
@@ -736,12 +746,18 @@ TModel.prototype.removeUpdatingChild = function(child) {
736
746
  }
737
747
  };
738
748
 
739
- TModel.prototype.addTarget = function(targetName, target) {
740
- this.targets[targetName] = target;
741
- this.activeTargetKeyMap[targetName] = true;
742
- delete this.targetValues[targetName];
749
+ TModel.prototype.removeTarget = function(key) {
750
+ delete this.targets[key];
751
+ delete this.activeTargetKeyMap[key];
752
+ delete this.targetValues[key];
753
+ };
754
+
755
+ TModel.prototype.addTarget = function(key, target) {
756
+ this.targets[key] = target;
757
+ this.activeTargetKeyMap[key] = true;
758
+ delete this.targetValues[key];
743
759
 
744
- tapp.manager.scheduleRun(10, 'addTarget-' + this.oid + "-" + targetName);
760
+ tapp.manager.scheduleRun(10, 'addTarget-' + this.oid + "-" + key);
745
761
  };
746
762
 
747
763
  TModel.prototype.addTargets = function(targets) {
@@ -18,6 +18,7 @@ TModelManager.prototype.init = function() {
18
18
  };
19
19
  this.visibleTypeMap = {};
20
20
  this.visibleOidMap = {};
21
+ this.targetExecuteMap = {};
21
22
 
22
23
  this.nextRuns = [];
23
24
  this.runningStep = 0;
@@ -48,6 +49,7 @@ TModelManager.prototype.analyze = function() {
48
49
  this.lists.updatingTargets.length = 0;
49
50
  this.visibleTypeMap = {};
50
51
  this.visibleOidMap = {};
52
+ this.targetExecuteMap = {};
51
53
 
52
54
  for (i = 0; i < tapp.locationManager.hasLocationList.length; i++) {
53
55
  tmodel = tapp.locationManager.hasLocationList[i];
@@ -66,6 +68,10 @@ TModelManager.prototype.analyze = function() {
66
68
  this.lists.updatingTModels.push(tmodel);
67
69
  this.lists.updatingTargets = this.lists.updatingTargets.concat((tmodel.targetUpdatingList));
68
70
  }
71
+
72
+ if (Object.keys(tmodel.targetExecuteMap).length > 0) {
73
+ this.targetExecuteMap[tmodel.oid] = Object.assign({}, tmodel.targetExecuteMap);
74
+ }
69
75
 
70
76
  this.visibleOidMap[tmodel.oid] = tmodel;
71
77
  if (!this.visibleTypeMap[tmodel.type]) {
@@ -136,6 +142,7 @@ TModelManager.prototype.deleteDoms = function () {
136
142
  tmodel.invisibleFunctions.forEach(function(invisible) {
137
143
  var key = invisible.key;
138
144
  invisible.fn.call(tmodel, key, tmodel.getTargetStep(key), tmodel.getTargetCycle(key), tmodel.getTargetSteps(key), tmodel.getTargetCycles(key));
145
+ tmodel.targetExecuteMap[key] = 'onInvisible';
139
146
  tmodel.activeTargetKeyMap[key] = true;
140
147
  });
141
148
  }
@@ -31,12 +31,13 @@ TargetManager.prototype.setTargetValues = function(tmodel) {
31
31
 
32
32
  tmodel.targetUpdatingMap = {};
33
33
  tmodel.targetUpdatingList = [];
34
+ tmodel.targetExecuteMap = {};
34
35
 
35
36
  for (var i = 0; i < activeKeys.length; i++) {
36
37
 
37
38
  var key = activeKeys[i];
38
39
 
39
- if (tmodel.targetUpdatingMap[key]) {
40
+ if (tmodel.targetUpdatingMap[key]) {
40
41
  continue;
41
42
  }
42
43
 
@@ -47,7 +48,7 @@ TargetManager.prototype.setTargetValues = function(tmodel) {
47
48
  }
48
49
 
49
50
  var result = this.setTargetValue(tmodel, key);
50
-
51
+
51
52
  if (result) {
52
53
  tmodel.targetUpdatingMap[key] = true;
53
54
  tmodel.targetUpdatingList.push(key);
@@ -79,15 +80,18 @@ TargetManager.prototype.setTargetValue = function(tmodel, key, force) {
79
80
  var cycle = tmodel.getTargetCycle(key);
80
81
  var valueArray = TargetUtil.getValueStepsCycles(tmodel, target, cycle, valueOnly, key);
81
82
  TargetUtil.assignValueArray(tmodel, key, valueArray);
83
+
84
+ if (!force) {
85
+ tmodel.targetExecuteMap[key] = 'value';
86
+ }
82
87
  }
83
-
88
+
84
89
  if (tmodel.isTargetInLoop(key)
85
- || !tmodel.isTargetDone(key)
86
- || !tmodel.isTargetComplete(key)
90
+ || (!tmodel.isTargetDone(key) && !tmodel.isTargetComplete(key))
87
91
  || TUtil.isDefined(tmodel.getActualTimeStamp(key))
88
92
  || !tmodel.hasTargetGotExecuted(key)) {
89
93
  tmodel.activeTargetKeyMap[key] = true;
90
- } else if (tmodel.activeTargetKeyMap[key]) {
94
+ } else if (tmodel.activeTargetKeyMap[key]) {
91
95
  delete tmodel.activeTargetKeyMap[key];
92
96
  }
93
97
 
@@ -100,6 +104,7 @@ TargetManager.prototype.setTargetValue = function(tmodel, key, force) {
100
104
 
101
105
  return (!tmodel.isTargetDone(key) && !tmodel.isTargetComplete(key)) || !tmodel.doesTargetEqualActual(key);
102
106
  } else {
107
+ tmodel.targetExecuteMap[key] = 'enabledOn';
103
108
  tmodel.activeTargetKeyMap[key] = true;
104
109
  }
105
110
  } else if (tmodel.activeTargetKeyMap[key]) {
@@ -115,7 +120,7 @@ TargetManager.prototype.setActualValues = function(tmodel) {
115
120
 
116
121
  for (i = 0; i < tmodel.targetUpdatingList.length; i++) {
117
122
  key = tmodel.targetUpdatingList[i];
118
-
123
+
119
124
  target = tmodel.targets[key];
120
125
  var status = tmodel.getTargetStatus(key);
121
126
 
@@ -130,7 +135,7 @@ TargetManager.prototype.setActualValues = function(tmodel) {
130
135
 
131
136
  for (i = 0; i < keys.length; i++) {
132
137
  key = keys[i];
133
-
138
+
134
139
  var schedulePeriod = TargetUtil.getActualSchedulePeriod(tmodel, key, tmodel.getTargetStepInterval(key));
135
140
  if (schedulePeriod === 0 || !TUtil.isDefined(schedulePeriod)) {
136
141
  this.setActualValue(tmodel, key);
@@ -181,6 +186,8 @@ TargetManager.prototype.setActualValue = function(tmodel, key) {
181
186
  var lastUpdate = tmodel.getActualValueLastUpdate(key);
182
187
  var oldValue = tmodel.actualValues[key], oldStep = step, oldCycle = cycle;
183
188
  var now = browser.now();
189
+
190
+ tmodel.targetExecuteMap[key] = 'value';
184
191
 
185
192
  if (step < steps) {
186
193
  if (!TUtil.isDefined(tmodel.getLastActualValue(key))) {
@@ -205,7 +212,8 @@ TargetManager.prototype.setActualValue = function(tmodel, key) {
205
212
  tmodel.setActualValueLastUpdate(key);
206
213
 
207
214
  if (typeof tmodel.targets[key] === 'object' && typeof tmodel.targets[key].onStepsEnd === 'function') {
208
- tmodel.targets[key].onStepsEnd.call(tmodel, key, cycle);
215
+ tmodel.targets[key].onStepsEnd.call(tmodel, key, cycle);
216
+ tmodel.targetExecuteMap[key] = 'onStepsEnd';
209
217
  }
210
218
 
211
219
  tmodel.updateTargetStatus(key);
package/src/TargetUtil.js CHANGED
@@ -189,7 +189,8 @@ TargetUtil.handleValueChange = function(tmodel, key, newValue, lastValue, step,
189
189
  if (typeof tmodel.targets[key] === 'object' && typeof tmodel.targets[key].onValueChange === 'function') {
190
190
  var valueChanged = !TUtil.areEqual(newValue, lastValue, tmodel.targets[key].deepEquality);
191
191
  if (valueChanged) {
192
- tmodel.targets[key].onValueChange.call(tmodel, key, newValue, lastValue, cycle);
192
+ tmodel.targets[key].onValueChange.call(tmodel, key, newValue, lastValue, cycle);
193
+ tmodel.targetExecuteMap[key] = 'onValueChange';
193
194
  }
194
195
  }
195
196
  };
package/src/Viewport.js CHANGED
@@ -41,7 +41,7 @@ Viewport.prototype.reset = function() {
41
41
  this.xSouth = x;
42
42
  this.xWest = x;
43
43
 
44
- this.xOverflow = TUtil.isDefined(this.tmodel.getValue('xOverflow')) ? this.tmodel.getValue('xOverflow') : x;
44
+ this.xOverflow = this.tmodel.getRealParent().getX();
45
45
 
46
46
  this.yNext = y;
47
47
  this.yNorth = y;