dcim-topology2d 2.2.0 → 3.0.2

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.
Files changed (217) hide show
  1. package/activity-diagram/src/final/final.d.ts +1 -1
  2. package/activity-diagram/src/final/final.rect.d.ts +1 -1
  3. package/activity-diagram/src/final/final.rect.js +1 -1
  4. package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
  5. package/activity-diagram/src/fork/fork.anchor.js +1 -1
  6. package/activity-diagram/src/fork/fork.d.ts +1 -1
  7. package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
  8. package/activity-diagram/src/fork/fork.rect.js +1 -1
  9. package/activity-diagram/src/register.js +1 -1
  10. package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
  11. package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
  12. package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
  13. package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
  14. package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
  15. package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
  16. package/chart-diagram/index.d.ts +1 -3
  17. package/chart-diagram/index.js +1 -2
  18. package/chart-diagram/src/echarts/index.d.ts +2 -1
  19. package/chart-diagram/src/echarts/index.js +104 -112
  20. package/chart-diagram/src/register.js +8 -9
  21. package/class-diagram/src/class/class.d.ts +1 -1
  22. package/class-diagram/src/class/class.rect.d.ts +1 -1
  23. package/class-diagram/src/class/class.rect.js +1 -1
  24. package/class-diagram/src/register.js +1 -1
  25. package/core/index.d.ts +0 -2
  26. package/core/index.js +0 -2
  27. package/core/src/activeLayer.d.ts +10 -2
  28. package/core/src/activeLayer.js +47 -42
  29. package/core/src/animateLayer.d.ts +7 -3
  30. package/core/src/animateLayer.js +12 -10
  31. package/core/src/calling.d.ts +4 -1
  32. package/core/src/calling.js +41 -43
  33. package/core/src/canvas.d.ts +6 -1
  34. package/core/src/canvas.js +21 -22
  35. package/core/src/common.d.ts +7 -6
  36. package/core/src/common.js +675 -343
  37. package/core/src/core.d.ts +4 -5
  38. package/core/src/core.js +385 -536
  39. package/core/src/divLayer.d.ts +36 -2
  40. package/core/src/divLayer.js +305 -33
  41. package/core/src/healps/changeData.d.ts +2 -1
  42. package/core/src/healps/changeData.js +100 -86
  43. package/core/src/hoverLayer.d.ts +9 -2
  44. package/core/src/hoverLayer.js +34 -31
  45. package/core/src/middles/default.d.ts +3 -1
  46. package/core/src/middles/default.js +51 -63
  47. package/core/src/middles/index.js +2 -3
  48. package/core/src/middles/nodes/arbitrarygraph.js +9 -11
  49. package/core/src/middles/nodes/pentagon.rect.js +1 -1
  50. package/core/src/middles/nodes/rectangle.rect.js +1 -1
  51. package/core/src/models/data.d.ts +26 -0
  52. package/core/src/models/data.js +77 -0
  53. package/core/src/models/data.js.map +1 -0
  54. package/core/src/models/index.d.ts +1 -0
  55. package/core/src/models/index.js +1 -0
  56. package/core/src/models/line.js +7 -7
  57. package/core/src/models/node.d.ts +0 -10
  58. package/core/src/models/node.js +101 -148
  59. package/core/src/models/pen.js +67 -27
  60. package/core/src/models/rect.js +2 -2
  61. package/core/src/mqtt.d.ts +14 -0
  62. package/core/src/mqtt.js +82 -0
  63. package/core/src/mqtt.js.map +1 -0
  64. package/core/src/offscreen.d.ts +4 -1
  65. package/core/src/offscreen.js +24 -26
  66. package/core/src/options.d.ts +1 -3
  67. package/core/src/options.js +0 -2
  68. package/core/src/poll.js +39 -0
  69. package/core/src/preview.d.ts +13 -2
  70. package/core/src/preview.js +43 -144
  71. package/core/src/renderLayer.d.ts +9 -11
  72. package/core/src/renderLayer.js +61 -60
  73. package/core/src/socket.d.ts +10 -0
  74. package/core/src/socket.js +51 -0
  75. package/core/src/socket.js.map +1 -0
  76. package/core/src/utils/canvas.js +1 -1
  77. package/core/src/utils/construction.d.ts +3 -36
  78. package/core/src/utils/construction.js +1 -29
  79. package/core/src/utils/conversion.d.ts +0 -15
  80. package/core/src/utils/conversion.js +0 -319
  81. package/core/src/utils/dom.d.ts +8 -0
  82. package/core/src/utils/dom.js +67 -0
  83. package/core/src/utils/dom.js.map +1 -0
  84. package/core/src/utils/index.d.ts +1 -2
  85. package/core/src/utils/index.js +1 -2
  86. package/core/src/utils/onmousevent.d.ts +0 -3
  87. package/core/src/utils/onmousevent.js +10 -42
  88. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  89. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  90. package/flow-diagram/src/comment/comment.d.ts +1 -1
  91. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  92. package/flow-diagram/src/data/data.anchor.js +1 -1
  93. package/flow-diagram/src/data/data.d.ts +1 -1
  94. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  95. package/flow-diagram/src/data/data.rect.js +1 -1
  96. package/flow-diagram/src/db/db.d.ts +1 -1
  97. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  98. package/flow-diagram/src/db/db.rect.js +1 -1
  99. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  100. package/flow-diagram/src/display/display.anchor.js +1 -1
  101. package/flow-diagram/src/display/display.d.ts +1 -1
  102. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  103. package/flow-diagram/src/display/display.rect.js +1 -1
  104. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  105. package/flow-diagram/src/document/document.anchor.js +1 -1
  106. package/flow-diagram/src/document/document.d.ts +1 -1
  107. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  108. package/flow-diagram/src/document/document.rect.js +1 -1
  109. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  110. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  111. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  112. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  113. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  114. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  115. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  116. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  117. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  118. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  119. package/flow-diagram/src/manually/manually.d.ts +1 -1
  120. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  121. package/flow-diagram/src/manually/manually.rect.js +1 -1
  122. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  123. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  124. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  125. package/flow-diagram/src/queue/queue.d.ts +1 -1
  126. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  127. package/flow-diagram/src/queue/queue.rect.js +1 -1
  128. package/flow-diagram/src/register.js +1 -1
  129. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  130. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  131. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  132. package/layout/src/align.d.ts +1 -1
  133. package/layout/src/align.js +1 -1
  134. package/layout/src/layout.d.ts +1 -1
  135. package/layout/src/layout.js +1 -1
  136. package/myShape-diagram/{index.js → myShape.js} +1 -4
  137. package/package.json +1 -1
  138. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  139. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  140. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  141. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  142. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  143. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  144. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  145. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  146. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  147. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  148. package/sequence-diagram/src/register.js +1 -1
  149. package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
  150. package/chart-diagram/src/utils/changeOptions.js +0 -267
  151. package/chart-diagram/src/utils/conversion.d.ts +0 -19
  152. package/chart-diagram/src/utils/conversion.js +0 -560
  153. package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
  154. package/chart-diagram/src/utils/drawGraphic.js +0 -97
  155. package/chart-diagram/src/utils/formatter.d.ts +0 -1
  156. package/chart-diagram/src/utils/formatter.js +0 -206
  157. package/chart-diagram/src/utils/index.d.ts +0 -5
  158. package/chart-diagram/src/utils/index.js +0 -5
  159. package/chart-diagram/src/utils/render.d.ts +0 -8
  160. package/chart-diagram/src/utils/render.js +0 -219
  161. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
  162. package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
  163. package/core/src/element/common.d.ts +0 -6
  164. package/core/src/element/common.js +0 -63
  165. package/core/src/element/datePicker.d.ts +0 -3
  166. package/core/src/element/datePicker.js +0 -44
  167. package/core/src/element/iframe.d.ts +0 -3
  168. package/core/src/element/iframe.js +0 -12
  169. package/core/src/element/index.d.ts +0 -5
  170. package/core/src/element/index.js +0 -6
  171. package/core/src/element/select.d.ts +0 -11
  172. package/core/src/element/select.js +0 -273
  173. package/core/src/element/tab.d.ts +0 -1
  174. package/core/src/element/tab.js +0 -20
  175. package/core/src/element/time.d.ts +0 -3
  176. package/core/src/element/time.js +0 -44
  177. package/core/src/middles/arrows/index.d.ts +0 -4
  178. package/core/src/middles/arrows/index.js +0 -5
  179. package/core/src/middles/lines/index.d.ts +0 -4
  180. package/core/src/middles/lines/index.js +0 -5
  181. package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
  182. package/core/src/middles/nodes/formDatePicker.js +0 -107
  183. package/core/src/middles/nodes/formoverflow.js +0 -61
  184. package/core/src/middles/nodes/formselect.d.ts +0 -2
  185. package/core/src/middles/nodes/formselect.js +0 -111
  186. package/core/src/middles/nodes/iframe.d.ts +0 -2
  187. package/core/src/middles/nodes/iframe.js +0 -29
  188. package/core/src/middles/nodes/index.d.ts +0 -51
  189. package/core/src/middles/nodes/index.js +0 -53
  190. package/core/src/middles/nodes/switchs.d.ts +0 -2
  191. package/core/src/middles/nodes/switchs.js +0 -46
  192. package/core/src/middles/nodes/time.d.ts +0 -2
  193. package/core/src/middles/nodes/time.js +0 -98
  194. package/core/src/store/common.d.ts +0 -9
  195. package/core/src/store/common.js +0 -5
  196. package/core/src/store/data.d.ts +0 -196
  197. package/core/src/store/data.js +0 -193
  198. package/core/src/store/index.d.ts +0 -2
  199. package/core/src/store/index.js +0 -2
  200. package/core/src/utils/assignment.d.ts +0 -7
  201. package/core/src/utils/assignment.js +0 -216
  202. package/core/src/utils/params.d.ts +0 -3
  203. package/core/src/utils/params.js +0 -136
  204. package/static/echartsDefaultData.js +0 -178
  205. package/static/element.js +0 -14
  206. package/static/form.js +0 -11
  207. package/static/index.js +0 -3
  208. package/store/actions.js +0 -1
  209. package/store/clear.js +0 -10
  210. package/store/default.js +0 -22
  211. package/store/index.js +0 -3
  212. package/style/common.css +0 -15
  213. package/style/datePicker.css +0 -44
  214. package/style/editor.css +0 -16
  215. package/style/index.css +0 -5
  216. package/style/select.css +0 -143
  217. /package/myShape-diagram/{index.ts → myShape.ts} +0 -0
@@ -1,8 +1,8 @@
1
1
  var __extends = (this && this.__extends) || (function () {
2
2
  var extendStatics = function (d, b) {
3
3
  extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
6
  return extendStatics(d, b);
7
7
  };
8
8
  return function (d, b) {
@@ -20,9 +20,8 @@ import { defaultAnchors } from '../middles/default.anchor';
20
20
  import { defaultIconRect, defaultTextRect } from '../middles/default.rect';
21
21
  import { text, tableText, defaultText, iconfont } from '../middles/nodes/text';
22
22
  import { Store } from 'le5le-store';
23
- import { abs, s8, animateType } from '../utils';
24
- export const images = {};
25
- export const defaultImages = {};
23
+ import { abs, s8, animateType, createChildrenDivByElementId } from '../utils';
24
+ export var images = {};
26
25
  var Node = /** @class */ (function (_super) {
27
26
  __extends(Node, _super);
28
27
  function Node(json, noChild) {
@@ -35,13 +34,9 @@ var Node = /** @class */ (function (_super) {
35
34
  _this.rotatedAnchors = [];
36
35
  _this.animateDuration = 0;
37
36
  _this.animateFrames = [];
38
- _this.attribute = json.attribute || 'default';
39
37
  _this.type = PenType.Node;
40
- _this.TID = json.TID;
41
- _this.selectDropdown = json.selectDropdown || false;
42
38
  _this.is3D = json.is3D;
43
39
  _this.z = json.z;
44
- _this.order = json.order;
45
40
  _this.zRotate = json.zRotate || 0;
46
41
  _this.borderRadius = +json.borderRadius || 0;
47
42
  _this.icon = json.icon;
@@ -49,16 +44,8 @@ var Node = /** @class */ (function (_super) {
49
44
  _this.iconSize = +json.iconSize;
50
45
  _this.iconColor = json.iconColor;
51
46
  _this.image = json.image;
52
- _this.tabData = json.tabData || {
53
- state: false,
54
- name: '℃',
55
- min: 0,
56
- max: 60,
57
- interval: 20
58
- };
59
47
  _this.floorImageIndex = json.floorImageIndex || false;
60
48
  _this.formData = json.formData || null;
61
- _this.pickerOptions = json.pickerOptions || null;
62
49
  _this.formStyle = json.formStyle || null;
63
50
  _this.formEvents = json.formEvents || [];
64
51
  _this.paginationData = json.paginationData || null;
@@ -92,8 +79,8 @@ var Node = /** @class */ (function (_super) {
92
79
  _this.leakageEnd = json.leakageEnd || 0;
93
80
  _this.leakageFillStyle = json.leakageFillStyle || '#ff0000';
94
81
  _this.bindStaticId = json.bindStaticId || '';
95
- //_this.buttonCheckSlide = json.buttonCheckSlide || '';
96
- _this.visitStrokeStyle = json.visitStrokeStyle || '';
82
+ _this.buttonCheckSlide = json.buttonCheckSlide || '';
83
+ _this.activeImgeIndex = json.activeImgeIndex || false;
97
84
  _this.thBottomStrokeStyle = json.thBottomStrokeStyle || '#fff';
98
85
  _this.thBottomLineWidth = json.thBottomLineWidth || 1;
99
86
  // 兼容老数据
@@ -134,31 +121,28 @@ var Node = /** @class */ (function (_super) {
134
121
  _this.animateDuration = json.animateDuration;
135
122
  }
136
123
  _this.animateType = json.animateType
137
- ? json.animateType
138
- : json.animateDuration
139
- ? 'custom'
140
- : '';
124
+ ? json.animateType
125
+ : json.animateDuration
126
+ ? 'custom'
127
+ : '';
141
128
  _this.animateAlone = json.animateAlone;
142
129
  _this.iframe = json.iframe;
143
- _this.iframePageAuto = json.iframePageAuto || false;
144
130
  _this.elementId = json.elementId;
145
131
  _this.audio = json.audio;
146
132
  _this.video = json.video;
147
133
  _this.play = json.play;
148
134
  _this.nextPlay = json.nextPlay;
149
- _this.time = json.time;
150
- _this.isOpen = json.isOpen;
151
135
  if (json.elementLoaded !== undefined) {
152
136
  _this.elementId = null;
153
137
  _this.elementLoaded = false;
154
138
  }
155
- if (this.name == 'arbitraryGraph') {
139
+ if(this.name == 'arbitraryGraph') {
156
140
  this.rect.circles = json.rect.circles;
157
141
  //let {x, y} = this.centroid(json.rect.circles);
158
- let minX = Math.min.apply(Math, json.rect.circles.map((item) => { return item.x }));
159
- let minY = Math.min.apply(Math, json.rect.circles.map((item) => { return item.y }));
160
- this.rect.x = minX;
161
- this.rect.y = minY;
142
+ let minX = Math.min.apply(Math, json.rect.circles.map((item)=>{ return item.x}));
143
+ let minY = Math.min.apply(Math, json.rect.circles.map((item)=>{ return item.y}));
144
+ this.rect.x = minX;
145
+ this.rect.y = minY;
162
146
  this.rect.ex = this.rect.x + this.rect.width;
163
147
  this.rect.ey = this.rect.y + this.rect.height;
164
148
  // this.rect.center.x = x;
@@ -166,8 +150,8 @@ var Node = /** @class */ (function (_super) {
166
150
  // console.log('this.rect', this.rect);
167
151
  // console.log('this---node---', this);
168
152
  }
169
- if (json.name === 'formTable') _this.setFormTableData(json);
170
- if (json.name === 'tablePagination') _this.setTablePagination(json);
153
+ if(json.name === 'formTable') _this.setFormTableData(json);
154
+ if(json.name === 'tablePagination') _this.setTablePagination(json);
171
155
  _this.init();
172
156
  if (!noChild) {
173
157
  _this.setChild(json.children);
@@ -176,16 +160,6 @@ var Node = /** @class */ (function (_super) {
176
160
  _this.children = null;
177
161
  }
178
162
 
179
- if (json.name === 'time') {
180
- _this.animateFn = function () {
181
- let date = new Date();
182
- var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
183
- var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
184
- var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
185
- _this.time = { h: hour, m: minute, s: second }
186
- }
187
- }
188
-
189
163
  return _this;
190
164
  }
191
165
  Node.cloneState = function (json) {
@@ -214,7 +188,7 @@ var Node = /** @class */ (function (_super) {
214
188
  this.addToDiv();
215
189
  };
216
190
  Node.prototype.setFormTableData = function (json) {
217
- if (!Store.get('FORM:tableData')) {
191
+ if(!Store.get('FORM:tableData')){
218
192
  Store.set('FORM:tableData', {
219
193
  data: {
220
194
  tableNodes: {},
@@ -229,18 +203,18 @@ var Node = /** @class */ (function (_super) {
229
203
  data: tableData
230
204
  })
231
205
  const fromData = Store.get('SYNC:tableData');
232
- if (fromData) {
233
- if (!fromData[json.id].loading) {
206
+ if(fromData) {
207
+ if(!fromData[json.id].loading){
234
208
  this.formData.tableBody = fromData[json.id].tableBody;
235
209
  this.formData.total = fromData[json.id].total;
236
- } else {
210
+ }else {
237
211
  this.formData.tableBody = null;
238
212
  this.formData.total = 0;
239
213
  }
240
214
  }
241
215
  };
242
216
  Node.prototype.setTablePagination = function (json) {
243
- if (!Store.get('FORM:tableData')) {
217
+ if(!Store.get('FORM:tableData')){
244
218
  Store.set('FORM:tableData', {
245
219
  data: {
246
220
  tableNodes: {},
@@ -252,17 +226,24 @@ var Node = /** @class */ (function (_super) {
252
226
  const tableData = Store.get('FORM:tableData').data;
253
227
  const fromData = Store.get('SYNC:tableData');
254
228
  const tnode = fromData ? fromData[json.paginationData.bindFromTableId] : null;
255
- if (tnode) json.paginationData.total = tnode.total;
229
+ if(tnode) json.paginationData.total = tnode.total;
256
230
  tableData.paginationNodes[json.id] = json;
257
231
  Store.set('FORM:tableData', {
258
232
  data: tableData
259
233
  })
260
234
  };
261
- Node.prototype.addToDiv = function () {
262
- if (this.iframe ||
263
- this.elementId ||
264
- this.hasGif()) {
235
+ Node.prototype.addToDiv = function (type) {
236
+ if (this.audio ||
237
+ this.video ||
238
+ this.iframe ||
239
+ this.elementId ||
240
+ this.hasGif()) {
241
+ if(type) {
242
+ // 复合Echarts初始化
243
+ createChildrenDivByElementId(this);
244
+ }else {
265
245
  Store.set(this.generateStoreKey('LT:addDiv'), this);
246
+ }
266
247
  }
267
248
  };
268
249
  Node.prototype.hasGif = function () {
@@ -292,7 +273,6 @@ var Node = /** @class */ (function (_super) {
292
273
  this.children = [];
293
274
  for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
294
275
  var item = children_1[_i];
295
- item.visible = this.visible;
296
276
  var child = void 0;
297
277
  switch (item.type) {
298
278
  case PenType.Line:
@@ -337,13 +317,13 @@ var Node = /** @class */ (function (_super) {
337
317
  this.drawBkRadialGradient(ctx);
338
318
  break;
339
319
  }
340
- if (this.name === 'tablePagination') defaultText(ctx, this);
320
+ if(this.name === 'tablePagination') defaultText(ctx, this);
341
321
  // Draw shape.
342
322
  drawNodeFns[this.name](ctx, this);
343
323
  // Draw text.
344
- if (this.name === 'formTable') {
324
+ if(this.name === 'formTable') {
345
325
  tableText(ctx, this);
346
- } else {
326
+ }else {
347
327
  if (this.name !== 'text' && this.text && !(this.image && this.floorImageIndex === true)) {
348
328
  text(ctx, this);
349
329
  }
@@ -425,10 +405,9 @@ var Node = /** @class */ (function (_super) {
425
405
  //this.drawImg(ctx);
426
406
  return;
427
407
  }
428
- const defaultImageNode = defaultImages[this.id];
429
408
  var img = new Image();
430
409
  img.crossOrigin = 'anonymous';
431
- img.src = defaultImageNode && defaultImageNode.status === 404 ? '' : this.image;
410
+ img.src = this.image;
432
411
  img.onload = function (e) {
433
412
  _this.lastImage = _this.image;
434
413
  _this.imgNaturalWidth = img.naturalWidth;
@@ -438,22 +417,14 @@ var Node = /** @class */ (function (_super) {
438
417
  img: img,
439
418
  cnt: 1,
440
419
  };
441
- if (defaultImageNode) delete defaultImages[_this.id];
442
420
  Store.set(_this.generateStoreKey('LT:imageLoaded'), true);
443
421
  if (!_this.gif && gif) {
444
422
  _this.gif = true;
445
423
  Store.set(_this.generateStoreKey('LT:addDiv'), _this);
446
424
  }
447
425
  };
448
- img.onerror = function (e) {
449
- // 图片加载失败时预留默认图为空
450
- defaultImages[_this.id] = {
451
- img: '',
452
- status: 404
453
- };
454
- };
455
426
  };
456
- Node.prototype.initDrawImg = function (ctx) {
427
+ Node.prototype.initDrawImg = function (ctx){
457
428
  var _this = this;
458
429
  ctx.save();
459
430
  ctx.shadowColor = '';
@@ -511,7 +482,7 @@ var Node = /** @class */ (function (_super) {
511
482
  y = rect.ey - h;
512
483
  break;
513
484
  }
514
- if (!_this.activeImgeIndex) ctx.drawImage(this.img, x, y, w, h);
485
+ if(!_this.activeImgeIndex) ctx.drawImage(this.img, x, y, w, h);
515
486
  ctx.restore();
516
487
  };
517
488
  Node.prototype.calcAnchors = function () {
@@ -556,21 +527,21 @@ var Node = /** @class */ (function (_super) {
556
527
  var parentW = parent.rect.width - parent.paddingLeftNum - parent.paddingRightNum;
557
528
  var parentH = parent.rect.height - parent.paddingTopNum - parent.paddingBottomNum;
558
529
  var x = parent.rect.x +
559
- parent.paddingLeftNum +
560
- abs(parentW, this.rectInParent.x) +
561
- abs(parentW, this.rectInParent.marginLeft);
530
+ parent.paddingLeftNum +
531
+ abs(parentW, this.rectInParent.x) +
532
+ abs(parentW, this.rectInParent.marginLeft);
562
533
  var y = parent.rect.y +
563
- parent.paddingTopNum +
564
- abs(parentH, this.rectInParent.y) +
565
- abs(parentW, this.rectInParent.marginTop);
534
+ parent.paddingTopNum +
535
+ abs(parentH, this.rectInParent.y) +
536
+ abs(parentW, this.rectInParent.marginTop);
566
537
  var w = abs(parentW, this.rectInParent.width);
567
538
  var h = abs(parentH, this.rectInParent.height);
568
539
  if (this.rectInParent.marginLeft === undefined &&
569
- this.rectInParent.marginRight) {
540
+ this.rectInParent.marginRight) {
570
541
  x -= abs(parentW, this.rectInParent.marginRight);
571
542
  }
572
543
  if (this.rectInParent.marginTop === undefined &&
573
- this.rectInParent.marginBottom) {
544
+ this.rectInParent.marginBottom) {
574
545
  y -= abs(parentW, this.rectInParent.marginBottom);
575
546
  }
576
547
  this.rect = new Rect(x, y, w, h);
@@ -601,15 +572,15 @@ var Node = /** @class */ (function (_super) {
601
572
  var parentH = parent.rect.height - parent.paddingTopNum - parent.paddingBottomNum;
602
573
  this.rectInParent = {
603
574
  x: ((this.rect.x - parent.rect.x - parent.paddingLeftNum) * 100) /
604
- parentW +
605
- '%',
575
+ parentW +
576
+ '%',
606
577
  y: ((this.rect.y - parent.rect.y - parent.paddingTopNum) * 100) / parentH +
607
- '%',
578
+ '%',
608
579
  width: (this.rect.width * 100) / parentW + '%',
609
580
  height: (this.rect.height * 100) / parentH + '%',
610
581
  rotate: this.rectInParent
611
- ? this.rectInParent.rotate || 0
612
- : this.rotate || 0,
582
+ ? this.rectInParent.rotate || 0
583
+ : this.rotate || 0,
613
584
  rect: this.rect.clone(),
614
585
  };
615
586
  };
@@ -630,7 +601,7 @@ var Node = /** @class */ (function (_super) {
630
601
  var timeline = now - this.animateStart;
631
602
  if (timeline > this.animateDuration) {
632
603
  if (++this.animateCycleIndex >= this.animateCycle &&
633
- this.animateCycle > 0) {
604
+ this.animateCycle > 0) {
634
605
  this.animateStart = 0;
635
606
  this.animateCycleIndex = 0;
636
607
  var item = this.animateFrames[this.animateFrames.length - 1];
@@ -638,8 +609,8 @@ var Node = /** @class */ (function (_super) {
638
609
  this.dash = item.state.dash;
639
610
  this.strokeStyle = item.state.strokeStyle;
640
611
  this.fillStyle = item.state.fillStyle;
641
- //this.text = item.state.text;
642
- //this.font = item.state.font;
612
+ this.text = item.state.text;
613
+ this.font = item.state.font;
643
614
  this.lineWidth = item.state.lineWidth;
644
615
  this.rotate = item.state.rotate;
645
616
  this.globalAlpha = item.state.globalAlpha;
@@ -665,83 +636,72 @@ var Node = /** @class */ (function (_super) {
665
636
  this.dash = item.state.dash;
666
637
  this.strokeStyle = item.state.strokeStyle;
667
638
  this.fillStyle = item.state.fillStyle;
668
- //this.text = item.state.text;
669
- //this.font = item.state.font;
639
+ this.text = item.state.text;
640
+ this.font = item.state.font;
670
641
  var rate = (timeline - item.start) / item.duration;
671
642
  if (item.linear) {
672
643
  // 线条左右流动动画
673
- if ([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset) {
674
- let o = item.state.lineDashOffset;
675
- switch (this.animateType) {
676
- case animateType.LeftFlow:
677
- o = Math.abs(o)
678
- if (o > 100) o = 1;
679
- o++
680
-
681
- break;
682
- case animateType.RightFlow:
683
- o = Math.abs(o) * -1
684
- if (o < -100) o = -1;
685
- o--
686
- break;
687
- }
688
- item.state.lineDashOffset = o
644
+ if([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset){
645
+ const lineDashOffset = item.state.lineDashOffset;
646
+ if (lineDashOffset > 100) item.state.lineDashOffset = 1;
647
+ if (lineDashOffset < -100) item.state.lineDashOffset = -1;
648
+ lineDashOffset > 0 ? item.state.lineDashOffset++ : item.state.lineDashOffset--;
689
649
  this.lineDashOffset = item.state.lineDashOffset;
690
- } else if (([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
650
+ }else if(([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
691
651
  // 旋转动画,判断逻辑先这么写,日后将所有动画统一在编辑器中配置,再做优化
692
652
  this.rotate =
693
- item.initState.rotate +
694
- (item.state.rotate - item.initState.rotate) * rate;
653
+ item.initState.rotate +
654
+ (item.state.rotate - item.initState.rotate) * rate;
695
655
  rectChanged = true;
696
- } else {
656
+ }else {
697
657
 
698
658
  if (item.state.rect.x !== item.initState.rect.x) {
699
659
  this.rect.x =
700
- item.initState.rect.x +
701
- (item.state.rect.x - item.initState.rect.x) * rate;
660
+ item.initState.rect.x +
661
+ (item.state.rect.x - item.initState.rect.x) * rate;
702
662
  rectChanged = true;
703
663
  }
704
664
  if (item.state.rect.y !== item.initState.rect.y) {
705
665
  this.rect.y =
706
- item.initState.rect.y +
707
- (item.state.rect.y - item.initState.rect.y) * rate;
666
+ item.initState.rect.y +
667
+ (item.state.rect.y - item.initState.rect.y) * rate;
708
668
  rectChanged = true;
709
669
  }
710
670
  if (item.state.rect.width !== item.initState.rect.width) {
711
671
  this.rect.width =
712
- item.initState.rect.width +
713
- (item.state.rect.width - item.initState.rect.width) * rate;
672
+ item.initState.rect.width +
673
+ (item.state.rect.width - item.initState.rect.width) * rate;
714
674
  rectChanged = true;
715
675
  }
716
676
  if (item.state.rect.height !== item.initState.rect.height) {
717
677
  this.rect.height =
718
- item.initState.rect.height +
719
- (item.state.rect.height - item.initState.rect.height) * rate;
678
+ item.initState.rect.height +
679
+ (item.state.rect.height - item.initState.rect.height) * rate;
720
680
  rectChanged = true;
721
681
  }
722
682
  this.rect.ex = this.rect.x + this.rect.width;
723
683
  this.rect.ey = this.rect.y + this.rect.height;
724
684
  this.rect.calcCenter();
725
685
  if (item.initState.z !== undefined &&
726
- item.state.z !== item.initState.z) {
686
+ item.state.z !== item.initState.z) {
727
687
  this.z =
728
- item.initState.z + (item.state.z - item.initState.z) * rate;
688
+ item.initState.z + (item.state.z - item.initState.z) * rate;
729
689
  rectChanged = true;
730
690
  }
731
691
  if (item.state.borderRadius !== item.initState.borderRadius) {
732
692
  this.borderRadius =
733
- item.initState.borderRadius +
734
- (item.state.borderRadius - item.initState.borderRadius) * rate;
693
+ item.initState.borderRadius +
694
+ (item.state.borderRadius - item.initState.borderRadius) * rate;
735
695
  }
736
696
  if (item.state.lineWidth !== item.initState.lineWidth) {
737
697
  this.lineWidth =
738
- item.initState.lineWidth +
739
- (item.state.lineWidth - item.initState.lineWidth) * rate;
698
+ item.initState.lineWidth +
699
+ (item.state.lineWidth - item.initState.lineWidth) * rate;
740
700
  }
741
701
  if (item.state.globalAlpha !== item.initState.globalAlpha) {
742
702
  this.globalAlpha =
743
- item.initState.globalAlpha +
744
- (item.state.globalAlpha - item.initState.globalAlpha) * rate;
703
+ item.initState.globalAlpha +
704
+ (item.state.globalAlpha - item.initState.globalAlpha) * rate;
745
705
  }
746
706
  }
747
707
  }
@@ -772,29 +732,28 @@ var Node = /** @class */ (function (_super) {
772
732
  h = scale;
773
733
  }
774
734
  this['oldRect'] = this.rect.clone();
775
- if (this.rect.circles) {
776
- for (let c = 0, circles = this.rect.circles; c < circles.length; c++) {
777
- circles[c].x = center.x - (center.x - circles[c].x) * w;
778
- circles[c].y = center.y - (center.y - circles[c].y) * h;
735
+ if(this.rect.circles) {
736
+ for(let c=0, circles= this.rect.circles; c<circles.length; c++) {
737
+ circles[c].x = (center.x - (center.x - circles[c].x)) * w;
738
+ circles[c].y = (center.y - (center.y - circles[c].y)) * h + 15;
779
739
  }
740
+ }else {
741
+ this.rect.x = center.x - (center.x - this.rect.x) * w;
742
+ if(this.rotate % 180) {
743
+ this.rect.x = this.rect.x + (this.rect.width * w - this.rect.width * h) / 2;
744
+ }
745
+ this.rect.y = center.y - (center.y - this.rect.y) * h;
780
746
  }
781
- this.rect.x = center.x - (center.x - this.rect.x) * w;
782
- if (this.rotate % 180) {
783
- this.rect.x = this.rect.x + (this.rect.width * w - this.rect.width * h) / 2;
784
- }
785
- this.rect.y = center.y - (center.y - this.rect.y) * h;
747
+ this.z *= scale;
786
748
  this.rect.width *= this.rotate % 180 ? h : w;
787
749
  this.rect.height *= h;
788
750
  this.rect.ex = this.rect.x + this.rect.width;
789
751
  this.rect.ey = this.rect.y + this.rect.height;
790
- this.z *= scale;
791
- if (!(center.type && center.type === 'bottLogo')) {
792
- if (this.imageWidth) {
793
- this.imageWidth *= w;
794
- }
795
- if (this.imageHeight) {
796
- this.imageHeight *= h;
797
- }
752
+ if (this.imageWidth) {
753
+ this.imageWidth *= w;
754
+ }
755
+ if (this.imageHeight) {
756
+ this.imageHeight *= h;
798
757
  }
799
758
  this.lastImage = null;
800
759
  this.font.fontSize *= scale;
@@ -892,12 +851,6 @@ var Node = /** @class */ (function (_super) {
892
851
  }
893
852
  };
894
853
  Node.prototype.translate = function (x, y) {
895
- if (this.rect.circles) {
896
- for (let c = 0, circles = this.rect.circles; c < circles.length; c++) {
897
- circles[c].x += x;
898
- circles[c].y += y;
899
- }
900
- }
901
854
  this.rect.x += x;
902
855
  this.rect.y += y;
903
856
  this.rect.ex = this.rect.x + this.rect.width;
@@ -950,7 +903,7 @@ var Node = /** @class */ (function (_super) {
950
903
  return n;
951
904
  };
952
905
  //新增属性
953
- Node.prototype.area = function (pts) {
906
+ Node.prototype.area = function(pts) {
954
907
  var area = 0;
955
908
  var pts = pts;
956
909
  var nPts = pts.length;
@@ -966,7 +919,7 @@ var Node = /** @class */ (function (_super) {
966
919
  area /= 2;
967
920
  return area;
968
921
  };
969
- Node.prototype.centroid = function (pts) {
922
+ Node.prototype.centroid = function(pts) {
970
923
  var pts = pts;
971
924
  var nPts = pts.length;
972
925
  var x = 0;