dcim-topology2d 2.0.8 → 2.2.0

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 (63) hide show
  1. package/chart-diagram/src/echarts/index.js +6 -3
  2. package/chart-diagram/src/utils/changeOptions.d.ts +1 -0
  3. package/chart-diagram/src/utils/changeOptions.js +41 -35
  4. package/chart-diagram/src/utils/conversion.d.ts +1 -1
  5. package/chart-diagram/src/utils/conversion.js +143 -15
  6. package/chart-diagram/src/utils/formatter.d.ts +1 -1
  7. package/chart-diagram/src/utils/formatter.js +51 -15
  8. package/chart-diagram/src/utils/index.d.ts +1 -0
  9. package/chart-diagram/src/utils/index.js +1 -0
  10. package/chart-diagram/src/utils/render.js +43 -52
  11. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +3 -0
  12. package/chart-diagram/src/utils/surfaceParametricConversion.js +252 -0
  13. package/core/src/common.js +24 -15
  14. package/core/src/core.d.ts +2 -0
  15. package/core/src/core.js +75 -23
  16. package/core/src/element/common.d.ts +2 -1
  17. package/core/src/element/common.js +27 -18
  18. package/core/src/element/datePicker.d.ts +3 -0
  19. package/core/src/element/datePicker.js +44 -0
  20. package/core/src/element/index.d.ts +2 -1
  21. package/core/src/element/index.js +3 -1
  22. package/core/src/element/select.d.ts +1 -1
  23. package/core/src/element/select.js +15 -5
  24. package/core/src/element/tab.js +6 -9
  25. package/core/src/element/time.d.ts +3 -0
  26. package/core/src/element/time.js +44 -0
  27. package/core/src/healps/changeData.js +61 -41
  28. package/core/src/middles/default.js +53 -43
  29. package/core/src/middles/nodes/formDatePicker.d.ts +2 -0
  30. package/core/src/middles/nodes/formDatePicker.js +107 -0
  31. package/core/src/middles/nodes/formselect.js +20 -4
  32. package/core/src/middles/nodes/index.d.ts +4 -1
  33. package/core/src/middles/nodes/index.js +4 -0
  34. package/core/src/middles/nodes/switchs.d.ts +2 -0
  35. package/core/src/middles/nodes/switchs.js +46 -0
  36. package/core/src/middles/nodes/time.d.ts +2 -0
  37. package/core/src/middles/nodes/time.js +98 -0
  38. package/core/src/models/line.js +7 -7
  39. package/core/src/models/node.js +88 -74
  40. package/core/src/models/pen.js +11 -11
  41. package/core/src/offscreen.js +19 -19
  42. package/core/src/preview.d.ts +1 -0
  43. package/core/src/preview.js +44 -11
  44. package/core/src/store/data.d.ts +7 -0
  45. package/core/src/store/data.js +15 -2
  46. package/core/src/utils/assignment.d.ts +2 -1
  47. package/core/src/utils/assignment.js +55 -12
  48. package/core/src/utils/construction.d.ts +24 -0
  49. package/core/src/utils/construction.js +22 -1
  50. package/core/src/utils/conversion.d.ts +4 -0
  51. package/core/src/utils/conversion.js +151 -0
  52. package/core/src/utils/math.d.ts +0 -1
  53. package/core/src/utils/math.js +0 -3
  54. package/core/src/utils/onmousevent.js +1 -1
  55. package/core/src/utils/params.d.ts +1 -0
  56. package/core/src/utils/params.js +80 -4
  57. package/package.json +1 -1
  58. package/store/default.js +22 -0
  59. package/store/index.js +2 -1
  60. package/style/common.css +0 -3
  61. package/style/datePicker.css +44 -0
  62. package/style/editor.css +3 -0
  63. package/style/index.css +1 -0
@@ -15,8 +15,13 @@ export function formSelect(ctx, node) {
15
15
  const currentStore = commonStore[node.TID];
16
16
  node.elementId = s8();
17
17
  node.dash = 4;
18
+ // 下拉切换类型
19
+ const selectedType = node.events && node.events.find((item) => {
20
+ return !!item.dcimStaticForType
21
+ });
18
22
  currentStore.selectDataPool[node.id] = {
19
23
  slideState: node.selectDropdown,
24
+ staticType: selectedType,
20
25
  node: {
21
26
  id: node.id,
22
27
  color: node.font.color,
@@ -35,19 +40,30 @@ export function formSelect(ctx, node) {
35
40
  // 去空格重新赋值
36
41
  node.formData.bindBlockTag = node.formData.bindBlockTag.trim();
37
42
  }
43
+
38
44
  let selectRealData = bindBlockId && currentStore.selectRealDataPool[bindBlockId];
39
- if(bindBlockId && selectRealData) {
40
- // select与echarts互相关联
41
- currentStore.selectDataPool[node.id].data = selectRealData;
45
+ if(selectRealData) {
46
+ // 数据统计之 select与echarts互相关联
47
+ if(node.formData.ids) {
48
+ // 显示隐藏类型下的数据统计,下拉节点数据处理
49
+ const optionIds = node.formData.ids.split(',');
50
+ for (let i = 0; i < optionIds.length; i++) {
51
+ if(selectRealData[i]) selectRealData[i].optionId = optionIds[i];
52
+ }
53
+ }
54
+ const selectData = currentStore.selectDataPool[node.id];
55
+ selectData.data = selectRealData;
56
+ selectData.node.selected ? selectData.node.selected.id = selectRealData[0].id : selectData.node.selected = { id: selectRealData[0].id };
42
57
  const echartsData = currentStore.echartsDataPool[bindBlockId];
43
58
  echartsData ? echartsData.bindId = node.id : currentStore.echartsDataPool[bindBlockId] = {
44
59
  bindId: node.id
45
60
  };
46
- // select与Tab关联
61
+ // select与Tab关联,主要用于下拉切换时当前画面绑定了tab切换的情况
47
62
  const bindBlockTagData = currentStore.switchTabDataPool[`${node.formData.bindBlockTag}Data`];
48
63
  if(bindBlockTagData) currentStore.echartsDataPool[bindBlockId].tabCorrelationType = 'select';
49
64
  }else {
50
65
  if(node.formData.ids) {
66
+ // 下拉显示隐藏
51
67
  const optionIds = node.formData.ids.split(',');
52
68
  const optionNames = node.formData.names.split(',');
53
69
  const optionsData = [];
@@ -45,4 +45,7 @@ export * from './text';
45
45
  export * from './triangle';
46
46
  export * from './triangle.anchor';
47
47
  export * from './triangle.rect';
48
- export * from './formoverflow';
48
+ export * from './formoverflow';
49
+ export * from './time';
50
+ export * from './formDatePicker';
51
+ export * from './switchs';
@@ -46,4 +46,8 @@ export * from './triangle';
46
46
  export * from './triangle.anchor';
47
47
  export * from './triangle.rect';
48
48
  export * from './formoverflow';
49
+ export * from './time';
50
+ export * from './formDatePicker';
51
+ export * from './switchs';
52
+
49
53
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import { Node } from 'dcim-topology2d/core/src/models';
2
+ export declare function switchs(ctx: CanvasRenderingContext2D, node: Node): void;
@@ -0,0 +1,46 @@
1
+ export function switchs(ctx, node) {
2
+
3
+ let x = node.rect.x;
4
+ let y = node.rect.y;
5
+ let width = node.rect.width;
6
+ let height = node.rect.height;
7
+ // 绘制圆角
8
+ var wr = node.borderRadius;
9
+ var hr = node.borderRadius;
10
+ if (node.borderRadius < 1) {
11
+ wr = node.rect.width * node.borderRadius;
12
+ hr = node.rect.height * node.borderRadius;
13
+ }
14
+ var r = wr < hr ? wr : hr;
15
+ if (node.rect.width < 2 * r) {
16
+ r = node.rect.width / 2;
17
+ }
18
+ if (node.rect.height < 2 * r) {
19
+ r = node.rect.height / 2;
20
+ }
21
+ //绘制椭圆
22
+ ctx.fillStyle = node.fillStyle;
23
+ ctx.beginPath();
24
+ ctx.moveTo(x + r, y);
25
+ ctx.lineTo(x + width - r, y);
26
+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);
27
+ ctx.lineTo(x + width, y + height - r);
28
+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);
29
+ ctx.lineTo(x + r, y + height);
30
+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);
31
+ ctx.lineTo(x, y + r);
32
+ ctx.quadraticCurveTo(x, y, x + r, y);
33
+ ctx.lineTo(x + width - r, y);
34
+ ctx.closePath();
35
+ node.fillStyle && ctx.fill();
36
+ ctx.stroke();
37
+
38
+ //绘制左侧 小圆 默认在右侧 isOpen:true
39
+ ctx.beginPath();
40
+ let cx = node.isOpen ? x + width - height * 0.5 : x + height * 0.5;
41
+ ctx.ellipse(cx, y + height * 0.5, height / 2 * 0.8, height / 2 * 0.8, 0, 0, Math.PI * 2);
42
+ ctx.fillStyle = '#ffffff';
43
+ ctx.closePath();
44
+ ctx.fill();
45
+ ctx.stroke();
46
+ }
@@ -0,0 +1,2 @@
1
+ import { Node } from '../../models';
2
+ export declare function time(ctx: CanvasRenderingContext2D, node: Node): void;
@@ -0,0 +1,98 @@
1
+ export function time(ctx, node) {
2
+ var wr = node.borderRadius;
3
+ var hr = node.borderRadius;
4
+ if (node.borderRadius < 1) {
5
+ wr = node.rect.width * node.borderRadius;
6
+ hr = node.rect.height * node.borderRadius;
7
+ }
8
+ var r = wr < hr ? wr : hr;
9
+ if (node.rect.width < 2 * r) {
10
+ r = node.rect.width / 2;
11
+ }
12
+ if (node.rect.height < 2 * r) {
13
+ r = node.rect.height / 2;
14
+ }
15
+
16
+ // 背景
17
+ let x = node.rect.x;
18
+ let y = node.rect.y;
19
+ let width = node.rect.width * 0.29;
20
+ let height = node.rect.height;
21
+ let gap = node.rect.width * 0.065;
22
+ let {h, m, s} = node.time;
23
+
24
+ //绘制时
25
+ drawText(ctx, r, x, y, width, height, h, node, gap)
26
+
27
+ //绘制分
28
+ drawText(ctx, r, x+width+gap, y, width, height, m, node, gap)
29
+
30
+ //绘制秒
31
+ drawText(ctx, r, x+(width*2 + gap*2), y, width, height, s, node)
32
+
33
+ //恢复填充色
34
+ ctx.fillStyle = "#ffffff";
35
+
36
+
37
+ }
38
+
39
+ function drawText(ctx, r, x, y, width, height, hText, node, gap) {
40
+
41
+ //文字
42
+ let textfillStyle = node.font.color || "#ffffff";
43
+ let textBackground = node.font.background || '#ffffff1a';
44
+ ctx.font = '' + node.font.fontSize +"px " + node.font.fontFamily;
45
+ ctx.textBaseline = 'middle';
46
+ ctx.textAlign = 'center';
47
+
48
+ const centerX = width / 2;
49
+ const centerY = height / 2;
50
+ //绘制上半部分
51
+ ctx.save();
52
+ ctx.beginPath();
53
+ ctx.fillStyle = textBackground;
54
+ ctx.beginPath();
55
+ ctx.moveTo(x + r, y);
56
+ ctx.lineTo(x + width -r, y);
57
+ ctx.quadraticCurveTo(x + width, y, x+width, y+r);
58
+ ctx.lineTo(x+width, y + height/2 - 1);
59
+ ctx.lineTo(x, y + height/2 - 1);
60
+ ctx.lineTo(x, y+r);
61
+ ctx.quadraticCurveTo(x, y, x+r, y);
62
+ ctx.fill();
63
+ ctx.clip();
64
+
65
+ ctx.fillStyle = textfillStyle;
66
+ ctx.fillText(hText, x+centerX, y+centerY);
67
+ ctx.restore();
68
+ //绘制下半部分
69
+ ctx.save();
70
+ ctx.beginPath();
71
+ ctx.fillStyle = textBackground;
72
+ ctx.moveTo(x, y+height/2+1);
73
+ ctx.lineTo(x+width, y+height/2+1);
74
+ ctx.lineTo(x+width, y+height-r);
75
+ ctx.quadraticCurveTo(x+width, y+height, x+width-r, y+height);
76
+ ctx.lineTo(x+r, y+height);
77
+ ctx.quadraticCurveTo(x, y+height, x, y+height-r);
78
+ ctx.lineTo(x, y+height/2+2);
79
+ ctx.fill();
80
+ ctx.clip();
81
+
82
+ ctx.fillStyle = textfillStyle;
83
+ ctx.fillText(hText, x+centerX, y+centerY);
84
+ ctx.restore();
85
+
86
+ //绘制冒号
87
+ if(!gap) return
88
+
89
+ ctx.fillStyle = textfillStyle;
90
+ ctx.textBaseline = 'middle';
91
+ ctx.textAlign = 'center';
92
+ let metricss = ctx.measureText(":");
93
+ const fontHeights = metricss.actualBoundingBoxAscent + metricss.actualBoundingBoxDescent;
94
+ const centerYY = y + (height / 2) + (metricss.actualBoundingBoxAscent - fontHeights / 2);
95
+ ctx.fillText(":", x+width+(gap/2), centerYY);
96
+ ctx.restore();
97
+
98
+ }
@@ -417,19 +417,19 @@ var Line = /** @class */ (function (_super) {
417
417
  }
418
418
  Store.set(this.generateStoreKey('pts-') + this.id, null);
419
419
  };
420
- Line.prototype.scale = function (scale, center) {
421
- this.from.x = center.x - (center.x - this.from.x) * scale;
422
- this.from.y = center.y - (center.y - this.from.y) * scale;
423
- this.to.x = center.x - (center.x - this.to.x) * scale;
424
- this.to.y = center.y - (center.y - this.to.y) * scale;
420
+ Line.prototype.scale = function (scale, center, w, h) {
421
+ this.from.x = center.x - (center.x - this.from.x) * w;
422
+ this.from.y = center.y - (center.y - this.from.y) * h;
423
+ this.to.x = center.x - (center.x - this.to.x) * w;
424
+ this.to.y = center.y - (center.y - this.to.y) * h;
425
425
  if (this.text && this.font && this.font.fontSize) {
426
426
  this.font.fontSize *= scale;
427
427
  this.textRect = null;
428
428
  }
429
429
  for (var _i = 0, _a = this.controlPoints; _i < _a.length; _i++) {
430
430
  var pt = _a[_i];
431
- pt.x = center.x - (center.x - pt.x) * scale;
432
- pt.y = center.y - (center.y - pt.y) * scale;
431
+ pt.x = center.x - (center.x - pt.x) * w;
432
+ pt.y = center.y - (center.y - pt.y) * h;
433
433
  }
434
434
  Store.set(this.generateStoreKey('pts-') + this.id, null);
435
435
  };
@@ -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) {
@@ -35,6 +35,7 @@ var Node = /** @class */ (function (_super) {
35
35
  _this.rotatedAnchors = [];
36
36
  _this.animateDuration = 0;
37
37
  _this.animateFrames = [];
38
+ _this.attribute = json.attribute || 'default';
38
39
  _this.type = PenType.Node;
39
40
  _this.TID = json.TID;
40
41
  _this.selectDropdown = json.selectDropdown || false;
@@ -57,6 +58,7 @@ var Node = /** @class */ (function (_super) {
57
58
  };
58
59
  _this.floorImageIndex = json.floorImageIndex || false;
59
60
  _this.formData = json.formData || null;
61
+ _this.pickerOptions = json.pickerOptions || null;
60
62
  _this.formStyle = json.formStyle || null;
61
63
  _this.formEvents = json.formEvents || [];
62
64
  _this.paginationData = json.paginationData || null;
@@ -132,10 +134,10 @@ var Node = /** @class */ (function (_super) {
132
134
  _this.animateDuration = json.animateDuration;
133
135
  }
134
136
  _this.animateType = json.animateType
135
- ? json.animateType
136
- : json.animateDuration
137
- ? 'custom'
138
- : '';
137
+ ? json.animateType
138
+ : json.animateDuration
139
+ ? 'custom'
140
+ : '';
139
141
  _this.animateAlone = json.animateAlone;
140
142
  _this.iframe = json.iframe;
141
143
  _this.iframePageAuto = json.iframePageAuto || false;
@@ -144,17 +146,19 @@ var Node = /** @class */ (function (_super) {
144
146
  _this.video = json.video;
145
147
  _this.play = json.play;
146
148
  _this.nextPlay = json.nextPlay;
149
+ _this.time = json.time;
150
+ _this.isOpen = json.isOpen;
147
151
  if (json.elementLoaded !== undefined) {
148
152
  _this.elementId = null;
149
153
  _this.elementLoaded = false;
150
154
  }
151
- if(this.name == 'arbitraryGraph') {
155
+ if (this.name == 'arbitraryGraph') {
152
156
  this.rect.circles = json.rect.circles;
153
157
  //let {x, y} = this.centroid(json.rect.circles);
154
- let minX = Math.min.apply(Math, json.rect.circles.map((item)=>{ return item.x}));
155
- let minY = Math.min.apply(Math, json.rect.circles.map((item)=>{ return item.y}));
156
- this.rect.x = minX;
157
- this.rect.y = minY;
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;
158
162
  this.rect.ex = this.rect.x + this.rect.width;
159
163
  this.rect.ey = this.rect.y + this.rect.height;
160
164
  // this.rect.center.x = x;
@@ -162,8 +166,8 @@ var Node = /** @class */ (function (_super) {
162
166
  // console.log('this.rect', this.rect);
163
167
  // console.log('this---node---', this);
164
168
  }
165
- if(json.name === 'formTable') _this.setFormTableData(json);
166
- if(json.name === 'tablePagination') _this.setTablePagination(json);
169
+ if (json.name === 'formTable') _this.setFormTableData(json);
170
+ if (json.name === 'tablePagination') _this.setTablePagination(json);
167
171
  _this.init();
168
172
  if (!noChild) {
169
173
  _this.setChild(json.children);
@@ -172,6 +176,16 @@ var Node = /** @class */ (function (_super) {
172
176
  _this.children = null;
173
177
  }
174
178
 
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
+
175
189
  return _this;
176
190
  }
177
191
  Node.cloneState = function (json) {
@@ -200,7 +214,7 @@ var Node = /** @class */ (function (_super) {
200
214
  this.addToDiv();
201
215
  };
202
216
  Node.prototype.setFormTableData = function (json) {
203
- if(!Store.get('FORM:tableData')){
217
+ if (!Store.get('FORM:tableData')) {
204
218
  Store.set('FORM:tableData', {
205
219
  data: {
206
220
  tableNodes: {},
@@ -215,18 +229,18 @@ var Node = /** @class */ (function (_super) {
215
229
  data: tableData
216
230
  })
217
231
  const fromData = Store.get('SYNC:tableData');
218
- if(fromData) {
219
- if(!fromData[json.id].loading){
232
+ if (fromData) {
233
+ if (!fromData[json.id].loading) {
220
234
  this.formData.tableBody = fromData[json.id].tableBody;
221
235
  this.formData.total = fromData[json.id].total;
222
- }else {
236
+ } else {
223
237
  this.formData.tableBody = null;
224
238
  this.formData.total = 0;
225
239
  }
226
240
  }
227
241
  };
228
242
  Node.prototype.setTablePagination = function (json) {
229
- if(!Store.get('FORM:tableData')){
243
+ if (!Store.get('FORM:tableData')) {
230
244
  Store.set('FORM:tableData', {
231
245
  data: {
232
246
  tableNodes: {},
@@ -238,7 +252,7 @@ var Node = /** @class */ (function (_super) {
238
252
  const tableData = Store.get('FORM:tableData').data;
239
253
  const fromData = Store.get('SYNC:tableData');
240
254
  const tnode = fromData ? fromData[json.paginationData.bindFromTableId] : null;
241
- if(tnode) json.paginationData.total = tnode.total;
255
+ if (tnode) json.paginationData.total = tnode.total;
242
256
  tableData.paginationNodes[json.id] = json;
243
257
  Store.set('FORM:tableData', {
244
258
  data: tableData
@@ -246,8 +260,8 @@ var Node = /** @class */ (function (_super) {
246
260
  };
247
261
  Node.prototype.addToDiv = function () {
248
262
  if (this.iframe ||
249
- this.elementId ||
250
- this.hasGif()) {
263
+ this.elementId ||
264
+ this.hasGif()) {
251
265
  Store.set(this.generateStoreKey('LT:addDiv'), this);
252
266
  }
253
267
  };
@@ -323,13 +337,13 @@ var Node = /** @class */ (function (_super) {
323
337
  this.drawBkRadialGradient(ctx);
324
338
  break;
325
339
  }
326
- if(this.name === 'tablePagination') defaultText(ctx, this);
340
+ if (this.name === 'tablePagination') defaultText(ctx, this);
327
341
  // Draw shape.
328
342
  drawNodeFns[this.name](ctx, this);
329
343
  // Draw text.
330
- if(this.name === 'formTable') {
344
+ if (this.name === 'formTable') {
331
345
  tableText(ctx, this);
332
- }else {
346
+ } else {
333
347
  if (this.name !== 'text' && this.text && !(this.image && this.floorImageIndex === true)) {
334
348
  text(ctx, this);
335
349
  }
@@ -424,14 +438,14 @@ var Node = /** @class */ (function (_super) {
424
438
  img: img,
425
439
  cnt: 1,
426
440
  };
427
- if(defaultImageNode) delete defaultImages[_this.id];
441
+ if (defaultImageNode) delete defaultImages[_this.id];
428
442
  Store.set(_this.generateStoreKey('LT:imageLoaded'), true);
429
443
  if (!_this.gif && gif) {
430
444
  _this.gif = true;
431
445
  Store.set(_this.generateStoreKey('LT:addDiv'), _this);
432
446
  }
433
447
  };
434
- img.onerror = function(e){
448
+ img.onerror = function (e) {
435
449
  // 图片加载失败时预留默认图为空
436
450
  defaultImages[_this.id] = {
437
451
  img: '',
@@ -439,7 +453,7 @@ var Node = /** @class */ (function (_super) {
439
453
  };
440
454
  };
441
455
  };
442
- Node.prototype.initDrawImg = function (ctx){
456
+ Node.prototype.initDrawImg = function (ctx) {
443
457
  var _this = this;
444
458
  ctx.save();
445
459
  ctx.shadowColor = '';
@@ -497,7 +511,7 @@ var Node = /** @class */ (function (_super) {
497
511
  y = rect.ey - h;
498
512
  break;
499
513
  }
500
- if(!_this.activeImgeIndex) ctx.drawImage(this.img, x, y, w, h);
514
+ if (!_this.activeImgeIndex) ctx.drawImage(this.img, x, y, w, h);
501
515
  ctx.restore();
502
516
  };
503
517
  Node.prototype.calcAnchors = function () {
@@ -542,21 +556,21 @@ var Node = /** @class */ (function (_super) {
542
556
  var parentW = parent.rect.width - parent.paddingLeftNum - parent.paddingRightNum;
543
557
  var parentH = parent.rect.height - parent.paddingTopNum - parent.paddingBottomNum;
544
558
  var x = parent.rect.x +
545
- parent.paddingLeftNum +
546
- abs(parentW, this.rectInParent.x) +
547
- abs(parentW, this.rectInParent.marginLeft);
559
+ parent.paddingLeftNum +
560
+ abs(parentW, this.rectInParent.x) +
561
+ abs(parentW, this.rectInParent.marginLeft);
548
562
  var y = parent.rect.y +
549
- parent.paddingTopNum +
550
- abs(parentH, this.rectInParent.y) +
551
- abs(parentW, this.rectInParent.marginTop);
563
+ parent.paddingTopNum +
564
+ abs(parentH, this.rectInParent.y) +
565
+ abs(parentW, this.rectInParent.marginTop);
552
566
  var w = abs(parentW, this.rectInParent.width);
553
567
  var h = abs(parentH, this.rectInParent.height);
554
568
  if (this.rectInParent.marginLeft === undefined &&
555
- this.rectInParent.marginRight) {
569
+ this.rectInParent.marginRight) {
556
570
  x -= abs(parentW, this.rectInParent.marginRight);
557
571
  }
558
572
  if (this.rectInParent.marginTop === undefined &&
559
- this.rectInParent.marginBottom) {
573
+ this.rectInParent.marginBottom) {
560
574
  y -= abs(parentW, this.rectInParent.marginBottom);
561
575
  }
562
576
  this.rect = new Rect(x, y, w, h);
@@ -587,15 +601,15 @@ var Node = /** @class */ (function (_super) {
587
601
  var parentH = parent.rect.height - parent.paddingTopNum - parent.paddingBottomNum;
588
602
  this.rectInParent = {
589
603
  x: ((this.rect.x - parent.rect.x - parent.paddingLeftNum) * 100) /
590
- parentW +
591
- '%',
604
+ parentW +
605
+ '%',
592
606
  y: ((this.rect.y - parent.rect.y - parent.paddingTopNum) * 100) / parentH +
593
- '%',
607
+ '%',
594
608
  width: (this.rect.width * 100) / parentW + '%',
595
609
  height: (this.rect.height * 100) / parentH + '%',
596
610
  rotate: this.rectInParent
597
- ? this.rectInParent.rotate || 0
598
- : this.rotate || 0,
611
+ ? this.rectInParent.rotate || 0
612
+ : this.rotate || 0,
599
613
  rect: this.rect.clone(),
600
614
  };
601
615
  };
@@ -616,7 +630,7 @@ var Node = /** @class */ (function (_super) {
616
630
  var timeline = now - this.animateStart;
617
631
  if (timeline > this.animateDuration) {
618
632
  if (++this.animateCycleIndex >= this.animateCycle &&
619
- this.animateCycle > 0) {
633
+ this.animateCycle > 0) {
620
634
  this.animateStart = 0;
621
635
  this.animateCycleIndex = 0;
622
636
  var item = this.animateFrames[this.animateFrames.length - 1];
@@ -656,78 +670,78 @@ var Node = /** @class */ (function (_super) {
656
670
  var rate = (timeline - item.start) / item.duration;
657
671
  if (item.linear) {
658
672
  // 线条左右流动动画
659
- if([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset){
673
+ if ([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset) {
660
674
  let o = item.state.lineDashOffset;
661
675
  switch (this.animateType) {
662
676
  case animateType.LeftFlow:
663
677
  o = Math.abs(o)
664
678
  if (o > 100) o = 1;
665
- o++
666
-
679
+ o++
680
+
667
681
  break;
668
682
  case animateType.RightFlow:
669
- o = Math.abs(o)*-1
683
+ o = Math.abs(o) * -1
670
684
  if (o < -100) o = -1;
671
685
  o--
672
686
  break;
673
687
  }
674
688
  item.state.lineDashOffset = o
675
689
  this.lineDashOffset = item.state.lineDashOffset;
676
- }else if(([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
690
+ } else if (([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
677
691
  // 旋转动画,判断逻辑先这么写,日后将所有动画统一在编辑器中配置,再做优化
678
692
  this.rotate =
679
- item.initState.rotate +
680
- (item.state.rotate - item.initState.rotate) * rate;
693
+ item.initState.rotate +
694
+ (item.state.rotate - item.initState.rotate) * rate;
681
695
  rectChanged = true;
682
- }else {
696
+ } else {
683
697
 
684
698
  if (item.state.rect.x !== item.initState.rect.x) {
685
699
  this.rect.x =
686
- item.initState.rect.x +
687
- (item.state.rect.x - item.initState.rect.x) * rate;
700
+ item.initState.rect.x +
701
+ (item.state.rect.x - item.initState.rect.x) * rate;
688
702
  rectChanged = true;
689
703
  }
690
704
  if (item.state.rect.y !== item.initState.rect.y) {
691
705
  this.rect.y =
692
- item.initState.rect.y +
693
- (item.state.rect.y - item.initState.rect.y) * rate;
706
+ item.initState.rect.y +
707
+ (item.state.rect.y - item.initState.rect.y) * rate;
694
708
  rectChanged = true;
695
709
  }
696
710
  if (item.state.rect.width !== item.initState.rect.width) {
697
711
  this.rect.width =
698
- item.initState.rect.width +
699
- (item.state.rect.width - item.initState.rect.width) * rate;
712
+ item.initState.rect.width +
713
+ (item.state.rect.width - item.initState.rect.width) * rate;
700
714
  rectChanged = true;
701
715
  }
702
716
  if (item.state.rect.height !== item.initState.rect.height) {
703
717
  this.rect.height =
704
- item.initState.rect.height +
705
- (item.state.rect.height - item.initState.rect.height) * rate;
718
+ item.initState.rect.height +
719
+ (item.state.rect.height - item.initState.rect.height) * rate;
706
720
  rectChanged = true;
707
721
  }
708
722
  this.rect.ex = this.rect.x + this.rect.width;
709
723
  this.rect.ey = this.rect.y + this.rect.height;
710
724
  this.rect.calcCenter();
711
725
  if (item.initState.z !== undefined &&
712
- item.state.z !== item.initState.z) {
726
+ item.state.z !== item.initState.z) {
713
727
  this.z =
714
- item.initState.z + (item.state.z - item.initState.z) * rate;
728
+ item.initState.z + (item.state.z - item.initState.z) * rate;
715
729
  rectChanged = true;
716
730
  }
717
731
  if (item.state.borderRadius !== item.initState.borderRadius) {
718
732
  this.borderRadius =
719
- item.initState.borderRadius +
720
- (item.state.borderRadius - item.initState.borderRadius) * rate;
733
+ item.initState.borderRadius +
734
+ (item.state.borderRadius - item.initState.borderRadius) * rate;
721
735
  }
722
736
  if (item.state.lineWidth !== item.initState.lineWidth) {
723
737
  this.lineWidth =
724
- item.initState.lineWidth +
725
- (item.state.lineWidth - item.initState.lineWidth) * rate;
738
+ item.initState.lineWidth +
739
+ (item.state.lineWidth - item.initState.lineWidth) * rate;
726
740
  }
727
741
  if (item.state.globalAlpha !== item.initState.globalAlpha) {
728
742
  this.globalAlpha =
729
- item.initState.globalAlpha +
730
- (item.state.globalAlpha - item.initState.globalAlpha) * rate;
743
+ item.initState.globalAlpha +
744
+ (item.state.globalAlpha - item.initState.globalAlpha) * rate;
731
745
  }
732
746
  }
733
747
  }
@@ -758,14 +772,14 @@ var Node = /** @class */ (function (_super) {
758
772
  h = scale;
759
773
  }
760
774
  this['oldRect'] = this.rect.clone();
761
- if(this.rect.circles) {
762
- for(let c=0, circles= this.rect.circles; c<circles.length; c++) {
775
+ if (this.rect.circles) {
776
+ for (let c = 0, circles = this.rect.circles; c < circles.length; c++) {
763
777
  circles[c].x = center.x - (center.x - circles[c].x) * w;
764
778
  circles[c].y = center.y - (center.y - circles[c].y) * h;
765
779
  }
766
780
  }
767
781
  this.rect.x = center.x - (center.x - this.rect.x) * w;
768
- if(this.rotate % 180) {
782
+ if (this.rotate % 180) {
769
783
  this.rect.x = this.rect.x + (this.rect.width * w - this.rect.width * h) / 2;
770
784
  }
771
785
  this.rect.y = center.y - (center.y - this.rect.y) * h;
@@ -774,7 +788,7 @@ var Node = /** @class */ (function (_super) {
774
788
  this.rect.ex = this.rect.x + this.rect.width;
775
789
  this.rect.ey = this.rect.y + this.rect.height;
776
790
  this.z *= scale;
777
- if(!(center.type && center.type === 'bottLogo')) {
791
+ if (!(center.type && center.type === 'bottLogo')) {
778
792
  if (this.imageWidth) {
779
793
  this.imageWidth *= w;
780
794
  }
@@ -878,8 +892,8 @@ var Node = /** @class */ (function (_super) {
878
892
  }
879
893
  };
880
894
  Node.prototype.translate = function (x, y) {
881
- if(this.rect.circles) {
882
- for(let c=0, circles= this.rect.circles; c<circles.length; c++) {
895
+ if (this.rect.circles) {
896
+ for (let c = 0, circles = this.rect.circles; c < circles.length; c++) {
883
897
  circles[c].x += x;
884
898
  circles[c].y += y;
885
899
  }
@@ -936,7 +950,7 @@ var Node = /** @class */ (function (_super) {
936
950
  return n;
937
951
  };
938
952
  //新增属性
939
- Node.prototype.area = function(pts) {
953
+ Node.prototype.area = function (pts) {
940
954
  var area = 0;
941
955
  var pts = pts;
942
956
  var nPts = pts.length;
@@ -952,7 +966,7 @@ var Node = /** @class */ (function (_super) {
952
966
  area /= 2;
953
967
  return area;
954
968
  };
955
- Node.prototype.centroid = function(pts) {
969
+ Node.prototype.centroid = function (pts) {
956
970
  var pts = pts;
957
971
  var nPts = pts.length;
958
972
  var x = 0;