dcim-topology2d 2.2.3 → 2.2.5

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 (191) hide show
  1. package/chart-diagram/src/echarts/index.js +2 -1
  2. package/chart-diagram/src/utils/conversion.js +12 -3
  3. package/core/src/activeLayer.d.ts +2 -0
  4. package/core/src/activeLayer.js +13 -0
  5. package/core/src/common.d.ts +1 -1
  6. package/core/src/common.js +109 -47
  7. package/core/src/core.d.ts +1 -1
  8. package/core/src/core.js +389 -317
  9. package/core/src/divLayer.js +65 -28
  10. package/core/src/element/select.js +2 -1
  11. package/core/src/healps/changeData.d.ts +0 -1
  12. package/core/src/healps/changeData.js +0 -4
  13. package/core/src/middles/default.js +8 -3
  14. package/core/src/middles/index.d.ts +1 -0
  15. package/core/src/middles/index.js +1 -0
  16. package/core/src/middles/nodes/{arbitrarygraph.anchor.d.ts → basic/arbitrarygraph.anchor.d.ts} +1 -1
  17. package/core/src/middles/nodes/{arbitrarygraph.anchor.js → basic/arbitrarygraph.anchor.js} +1 -1
  18. package/core/src/middles/nodes/{arbitrarygraph.d.ts → basic/arbitrarygraph.d.ts} +1 -1
  19. package/core/src/middles/nodes/{arrow.anchor.d.ts → basic/arrow.anchor.d.ts} +1 -1
  20. package/core/src/middles/nodes/{arrow.anchor.js → basic/arrow.anchor.js} +2 -2
  21. package/core/src/middles/nodes/{arrow.d.ts → basic/arrow.d.ts} +1 -1
  22. package/core/src/middles/nodes/{arrow.rect.d.ts → basic/arrow.rect.d.ts} +1 -1
  23. package/core/src/middles/nodes/{arrow.rect.js → basic/arrow.rect.js} +1 -1
  24. package/core/src/middles/nodes/{circle.anchor.d.ts → basic/circle.anchor.d.ts} +1 -1
  25. package/core/src/middles/nodes/{circle.anchor.js → basic/circle.anchor.js} +2 -2
  26. package/core/src/middles/nodes/{circle.d.ts → basic/circle.d.ts} +1 -1
  27. package/core/src/middles/nodes/basic/circle.js +8 -0
  28. package/core/src/middles/nodes/{circle.rect.d.ts → basic/circle.rect.d.ts} +1 -1
  29. package/core/src/middles/nodes/{circle.rect.js → basic/circle.rect.js} +1 -1
  30. package/core/src/middles/nodes/{cloud.anchor.d.ts → basic/cloud.anchor.d.ts} +1 -1
  31. package/core/src/middles/nodes/{cloud.anchor.js → basic/cloud.anchor.js} +2 -2
  32. package/core/src/middles/nodes/{cloud.d.ts → basic/cloud.d.ts} +1 -1
  33. package/core/src/middles/nodes/{cloud.rect.d.ts → basic/cloud.rect.d.ts} +1 -1
  34. package/core/src/middles/nodes/{cloud.rect.js → basic/cloud.rect.js} +1 -1
  35. package/core/src/middles/nodes/{cube.anchor.d.ts → basic/cube.anchor.d.ts} +1 -1
  36. package/core/src/middles/nodes/{cube.anchor.js → basic/cube.anchor.js} +2 -2
  37. package/core/src/middles/nodes/{cube.d.ts → basic/cube.d.ts} +1 -1
  38. package/core/src/middles/nodes/{cube.model.d.ts → basic/cube.model.d.ts} +2 -2
  39. package/core/src/middles/nodes/{cube.model.js → basic/cube.model.js} +2 -2
  40. package/core/src/middles/nodes/{cube.rect.d.ts → basic/cube.rect.d.ts} +1 -1
  41. package/core/src/middles/nodes/{cube.rect.js → basic/cube.rect.js} +1 -1
  42. package/core/src/middles/nodes/{diamond.d.ts → basic/diamond.d.ts} +1 -1
  43. package/core/src/middles/nodes/{diamond.rect.d.ts → basic/diamond.rect.d.ts} +1 -1
  44. package/core/src/middles/nodes/{diamond.rect.js → basic/diamond.rect.js} +1 -1
  45. package/core/src/middles/nodes/{file.d.ts → basic/file.d.ts} +1 -1
  46. package/core/src/middles/nodes/{iframe.d.ts → basic/iframe.d.ts} +1 -1
  47. package/core/src/middles/nodes/{iframe.js → basic/iframe.js} +7 -5
  48. package/core/src/middles/nodes/{image.anchor.d.ts → basic/image.anchor.d.ts} +1 -1
  49. package/core/src/middles/nodes/{image.anchor.js → basic/image.anchor.js} +2 -2
  50. package/core/src/middles/nodes/{image.rect.d.ts → basic/image.rect.d.ts} +1 -1
  51. package/core/src/middles/nodes/{image.rect.js → basic/image.rect.js} +1 -1
  52. package/core/src/middles/nodes/{line.anchor.d.ts → basic/line.anchor.d.ts} +1 -1
  53. package/core/src/middles/nodes/{line.anchor.js → basic/line.anchor.js} +2 -2
  54. package/core/src/middles/nodes/{line.d.ts → basic/line.d.ts} +1 -1
  55. package/core/src/middles/nodes/{line.rect.d.ts → basic/line.rect.d.ts} +1 -1
  56. package/core/src/middles/nodes/{line.rect.js → basic/line.rect.js} +1 -1
  57. package/core/src/middles/nodes/{message.anchor.d.ts → basic/message.anchor.d.ts} +1 -1
  58. package/core/src/middles/nodes/{message.anchor.js → basic/message.anchor.js} +2 -2
  59. package/core/src/middles/nodes/{message.d.ts → basic/message.d.ts} +1 -1
  60. package/core/src/middles/nodes/{message.rect.d.ts → basic/message.rect.d.ts} +1 -1
  61. package/core/src/middles/nodes/{message.rect.js → basic/message.rect.js} +1 -1
  62. package/core/src/middles/nodes/{pentagon.anchor.d.ts → basic/pentagon.anchor.d.ts} +1 -1
  63. package/core/src/middles/nodes/{pentagon.anchor.js → basic/pentagon.anchor.js} +2 -2
  64. package/core/src/middles/nodes/{pentagon.d.ts → basic/pentagon.d.ts} +1 -1
  65. package/core/src/middles/nodes/{pentagon.rect.d.ts → basic/pentagon.rect.d.ts} +1 -1
  66. package/core/src/middles/nodes/{pentagon.rect.js → basic/pentagon.rect.js} +1 -1
  67. package/core/src/middles/nodes/{pentagram.anchor.d.ts → basic/pentagram.anchor.d.ts} +1 -1
  68. package/core/src/middles/nodes/{pentagram.anchor.js → basic/pentagram.anchor.js} +2 -2
  69. package/core/src/middles/nodes/{pentagram.d.ts → basic/pentagram.d.ts} +1 -1
  70. package/core/src/middles/nodes/{pentagram.rect.d.ts → basic/pentagram.rect.d.ts} +1 -1
  71. package/core/src/middles/nodes/{pentagram.rect.js → basic/pentagram.rect.js} +1 -1
  72. package/core/src/middles/nodes/{people.d.ts → basic/people.d.ts} +1 -1
  73. package/core/src/middles/nodes/{people.rect.d.ts → basic/people.rect.d.ts} +1 -1
  74. package/core/src/middles/nodes/{people.rect.js → basic/people.rect.js} +1 -1
  75. package/core/src/middles/nodes/{rectangle.d.ts → basic/rectangle.d.ts} +1 -1
  76. package/core/src/middles/nodes/{rectangle.js → basic/rectangle.js} +1 -1
  77. package/core/src/middles/nodes/{rectangle.rect.d.ts → basic/rectangle.rect.d.ts} +1 -1
  78. package/core/src/middles/nodes/{rectangle.rect.js → basic/rectangle.rect.js} +1 -1
  79. package/core/src/middles/nodes/{text.d.ts → basic/text.d.ts} +3 -2
  80. package/core/src/middles/nodes/{triangle.anchor.d.ts → basic/triangle.anchor.d.ts} +1 -1
  81. package/core/src/middles/nodes/{triangle.anchor.js → basic/triangle.anchor.js} +2 -2
  82. package/core/src/middles/nodes/{triangle.d.ts → basic/triangle.d.ts} +1 -1
  83. package/core/src/middles/nodes/{triangle.rect.d.ts → basic/triangle.rect.d.ts} +1 -1
  84. package/core/src/middles/nodes/{triangle.rect.js → basic/triangle.rect.js} +1 -1
  85. package/core/src/middles/nodes/custom/humiture.d.ts +2 -0
  86. package/core/src/middles/nodes/custom/humiture.js +24 -0
  87. package/core/src/middles/nodes/{hexagon.anchor.d.ts → flow/hexagon.anchor.d.ts} +1 -1
  88. package/core/src/middles/nodes/{hexagon.anchor.js → flow/hexagon.anchor.js} +2 -2
  89. package/core/src/middles/nodes/{hexagon.d.ts → flow/hexagon.d.ts} +1 -1
  90. package/core/src/middles/nodes/{hexagon.rect.d.ts → flow/hexagon.rect.d.ts} +1 -1
  91. package/core/src/middles/nodes/{hexagon.rect.js → flow/hexagon.rect.js} +1 -1
  92. package/core/src/middles/nodes/form/formDatePicker.d.ts +2 -0
  93. package/core/src/middles/nodes/{formDatePicker.js → form/formDatePicker.js} +12 -5
  94. package/core/src/middles/nodes/{formoverflow.js → form/formoverflow.js} +11 -8
  95. package/core/src/middles/nodes/{formselect.d.ts → form/formselect.d.ts} +1 -1
  96. package/core/src/middles/nodes/{formselect.js → form/formselect.js} +6 -7
  97. package/core/src/middles/nodes/{formtable.d.ts → form/formtable.d.ts} +1 -1
  98. package/core/src/middles/nodes/{progress.d.ts → form/progress.d.ts} +2 -2
  99. package/core/src/middles/nodes/{tablePagination.d.ts → form/tablePagination.d.ts} +1 -1
  100. package/core/src/middles/nodes/{time.d.ts → form/time.d.ts} +1 -1
  101. package/core/src/middles/nodes/icon/echartLine.d.ts +2 -0
  102. package/core/src/middles/nodes/icon/echartLine.js +99 -0
  103. package/core/src/middles/nodes/index.d.ts +54 -52
  104. package/core/src/middles/nodes/index.js +54 -53
  105. package/core/src/models/line.js +1 -1
  106. package/core/src/models/node.js +16 -12
  107. package/core/src/models/pen.d.ts +6 -0
  108. package/core/src/models/rect.d.ts +1 -0
  109. package/core/src/models/rect.js +13 -7
  110. package/core/src/options.js +5 -1
  111. package/core/src/preview.js +55 -23
  112. package/core/src/renderLayer.js +5 -0
  113. package/core/src/store/data.d.ts +0 -1
  114. package/core/src/store/data.js +3 -46
  115. package/core/src/utils/assignment.js +41 -43
  116. package/core/src/utils/construction.d.ts +18 -0
  117. package/core/src/utils/construction.js +23 -0
  118. package/core/src/utils/conversion.d.ts +5 -7
  119. package/core/src/utils/conversion.js +212 -25
  120. package/core/src/utils/params.js +1 -0
  121. package/myShape-diagram/index.js +1 -2
  122. package/package.json +1 -1
  123. package/static/icon.js +10 -0
  124. package/static/index.js +2 -1
  125. package/store/actions.js +15 -1
  126. package/store/clear.js +67 -4
  127. package/core/src/middles/nodes/circle.js +0 -7
  128. package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
  129. /package/core/src/middles/nodes/{arbitrarygraph.js → basic/arbitrarygraph.js} +0 -0
  130. /package/core/src/middles/nodes/{arrow.anchor.js.map → basic/arrow.anchor.js.map} +0 -0
  131. /package/core/src/middles/nodes/{arrow.js → basic/arrow.js} +0 -0
  132. /package/core/src/middles/nodes/{arrow.js.map → basic/arrow.js.map} +0 -0
  133. /package/core/src/middles/nodes/{arrow.rect.js.map → basic/arrow.rect.js.map} +0 -0
  134. /package/core/src/middles/nodes/{circle.anchor.js.map → basic/circle.anchor.js.map} +0 -0
  135. /package/core/src/middles/nodes/{circle.js.map → basic/circle.js.map} +0 -0
  136. /package/core/src/middles/nodes/{circle.rect.js.map → basic/circle.rect.js.map} +0 -0
  137. /package/core/src/middles/nodes/{cloud.anchor.js.map → basic/cloud.anchor.js.map} +0 -0
  138. /package/core/src/middles/nodes/{cloud.js → basic/cloud.js} +0 -0
  139. /package/core/src/middles/nodes/{cloud.js.map → basic/cloud.js.map} +0 -0
  140. /package/core/src/middles/nodes/{cloud.rect.js.map → basic/cloud.rect.js.map} +0 -0
  141. /package/core/src/middles/nodes/{cube.anchor.js.map → basic/cube.anchor.js.map} +0 -0
  142. /package/core/src/middles/nodes/{cube.js → basic/cube.js} +0 -0
  143. /package/core/src/middles/nodes/{cube.js.map → basic/cube.js.map} +0 -0
  144. /package/core/src/middles/nodes/{cube.model.js.map → basic/cube.model.js.map} +0 -0
  145. /package/core/src/middles/nodes/{cube.rect.js.map → basic/cube.rect.js.map} +0 -0
  146. /package/core/src/middles/nodes/{diamond.js → basic/diamond.js} +0 -0
  147. /package/core/src/middles/nodes/{diamond.js.map → basic/diamond.js.map} +0 -0
  148. /package/core/src/middles/nodes/{diamond.rect.js.map → basic/diamond.rect.js.map} +0 -0
  149. /package/core/src/middles/nodes/{file.js → basic/file.js} +0 -0
  150. /package/core/src/middles/nodes/{file.js.map → basic/file.js.map} +0 -0
  151. /package/core/src/middles/nodes/{image.anchor.js.map → basic/image.anchor.js.map} +0 -0
  152. /package/core/src/middles/nodes/{image.rect.js.map → basic/image.rect.js.map} +0 -0
  153. /package/core/src/middles/nodes/{line.anchor.js.map → basic/line.anchor.js.map} +0 -0
  154. /package/core/src/middles/nodes/{line.js → basic/line.js} +0 -0
  155. /package/core/src/middles/nodes/{line.js.map → basic/line.js.map} +0 -0
  156. /package/core/src/middles/nodes/{line.rect.js.map → basic/line.rect.js.map} +0 -0
  157. /package/core/src/middles/nodes/{message.anchor.js.map → basic/message.anchor.js.map} +0 -0
  158. /package/core/src/middles/nodes/{message.js → basic/message.js} +0 -0
  159. /package/core/src/middles/nodes/{message.js.map → basic/message.js.map} +0 -0
  160. /package/core/src/middles/nodes/{message.rect.js.map → basic/message.rect.js.map} +0 -0
  161. /package/core/src/middles/nodes/{pentagon.anchor.js.map → basic/pentagon.anchor.js.map} +0 -0
  162. /package/core/src/middles/nodes/{pentagon.js → basic/pentagon.js} +0 -0
  163. /package/core/src/middles/nodes/{pentagon.js.map → basic/pentagon.js.map} +0 -0
  164. /package/core/src/middles/nodes/{pentagon.rect.js.map → basic/pentagon.rect.js.map} +0 -0
  165. /package/core/src/middles/nodes/{pentagram.anchor.js.map → basic/pentagram.anchor.js.map} +0 -0
  166. /package/core/src/middles/nodes/{pentagram.js → basic/pentagram.js} +0 -0
  167. /package/core/src/middles/nodes/{pentagram.js.map → basic/pentagram.js.map} +0 -0
  168. /package/core/src/middles/nodes/{pentagram.rect.js.map → basic/pentagram.rect.js.map} +0 -0
  169. /package/core/src/middles/nodes/{people.js → basic/people.js} +0 -0
  170. /package/core/src/middles/nodes/{people.js.map → basic/people.js.map} +0 -0
  171. /package/core/src/middles/nodes/{people.rect.js.map → basic/people.rect.js.map} +0 -0
  172. /package/core/src/middles/nodes/{rectangle.js.map → basic/rectangle.js.map} +0 -0
  173. /package/core/src/middles/nodes/{rectangle.rect.js.map → basic/rectangle.rect.js.map} +0 -0
  174. /package/core/src/middles/nodes/{text.js → basic/text.js} +0 -0
  175. /package/core/src/middles/nodes/{text.js.map → basic/text.js.map} +0 -0
  176. /package/core/src/middles/nodes/{triangle.anchor.js.map → basic/triangle.anchor.js.map} +0 -0
  177. /package/core/src/middles/nodes/{triangle.js → basic/triangle.js} +0 -0
  178. /package/core/src/middles/nodes/{triangle.js.map → basic/triangle.js.map} +0 -0
  179. /package/core/src/middles/nodes/{triangle.rect.js.map → basic/triangle.rect.js.map} +0 -0
  180. /package/core/src/middles/nodes/{hexagon.anchor.js.map → flow/hexagon.anchor.js.map} +0 -0
  181. /package/core/src/middles/nodes/{hexagon.js → flow/hexagon.js} +0 -0
  182. /package/core/src/middles/nodes/{hexagon.js.map → flow/hexagon.js.map} +0 -0
  183. /package/core/src/middles/nodes/{hexagon.rect.js.map → flow/hexagon.rect.js.map} +0 -0
  184. /package/core/src/middles/nodes/{formtable.js → form/formtable.js} +0 -0
  185. /package/core/src/middles/nodes/{progress.js → form/progress.js} +0 -0
  186. /package/core/src/middles/nodes/{progress.js.map → form/progress.js.map} +0 -0
  187. /package/core/src/middles/nodes/{switchs.d.ts → form/switchs.d.ts} +0 -0
  188. /package/core/src/middles/nodes/{switchs.js → form/switchs.js} +0 -0
  189. /package/core/src/middles/nodes/{tablePagination.js → form/tablePagination.js} +0 -0
  190. /package/core/src/middles/nodes/{time.js → form/time.js} +0 -0
  191. /package/static/{echartsDefaultData.js → echarts.js} +0 -0
package/core/src/core.js CHANGED
@@ -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) {
@@ -17,24 +17,23 @@ import {HoverLayer} from './hoverLayer';
17
17
  import {ActiveLayer} from './activeLayer';
18
18
  import {KeyType, KeydownType} from './options';
19
19
  import {PenType, Node, Point, Line, Lock, AnchorMode, Rect} from './models';
20
- import {drawNodeFns, drawLineFns} from './middles/index';
20
+ import {drawNodeFns, drawLineFns, defaultTextRect} from './middles/index';
21
21
  import {
22
22
  s8,
23
23
  pointInRect,
24
24
  formatPadding,
25
- setTagIdData,
26
- setKpiAddrData,
27
- setAssetIdData,
28
- setAreaIdData,
29
- setVarValueData,
30
- setBranchAddressData,
31
- setThreeCategoryIdData,
25
+ setConfBindPointMonitorData,
26
+ createEchartsLineIcon,
32
27
  setConnectionTagForConf,
33
28
  setConnectionTabsData,
34
- getTabConnectSHConf
29
+ getTabConnectSHConf,
30
+ bindDataConfig,
31
+ hasBoundData,
32
+ dataBindType
35
33
  } from './utils';
36
34
  import {setSelectElementPosition} from './element';
37
35
  import {elementType} from '../../static';
36
+ import {bindDataWithIconAssociationPool, iconMotionData} from "../../store";
38
37
 
39
38
  var resizeCursors = ['nw-resize', 'ne-resize', 'se-resize', 'sw-resize'];
40
39
  var dockOffset = 10;
@@ -63,6 +62,8 @@ var Topology = (function (_super) {
63
62
  isDragging: false, //是否在抓取
64
63
  close: false, //闭合
65
64
  };
65
+ _this.pos = null;
66
+ _this.clipboard = null;
66
67
  _this.onMouseMove = function (e) {
67
68
  if (Store.get('addingArbitraryGraph')) {
68
69
  return
@@ -112,7 +113,7 @@ var Topology = (function (_super) {
112
113
  _this.dispatch('translate', {x, y});
113
114
  return false;
114
115
  }
115
-
116
+
116
117
  }
117
118
  if (_this.store.data.locked && _this.mouseDown) {
118
119
  return;
@@ -120,14 +121,16 @@ var Topology = (function (_super) {
120
121
  _this.scheduledAnimationFrame = true;
121
122
  var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
122
123
  var pos = new Point(e.x - canvasPos.x, e.y - canvasPos.y);
124
+ _this.pos = pos;
123
125
  if (_this.raf)
124
126
  cancelAnimationFrame(_this.raf);
125
127
  _this.raf = requestAnimationFrame(function () {
126
128
  _this.raf = null;
127
129
  if (!_this.mouseDown) {
128
130
  _this.getMoveIn(pos);
131
+ const hoverNode = _this.moveIn.hoverNode;
129
132
  // Render hover anchors.
130
- if (_this.moveIn.hoverNode !== _this.lastHoverNode) {
133
+ if (hoverNode !== _this.lastHoverNode) {
131
134
  if (_this.lastHoverNode) {
132
135
  // Send a move event.
133
136
  _this.dispatch('moveOutNode', _this.lastHoverNode);
@@ -135,11 +138,11 @@ var Topology = (function (_super) {
135
138
  // Clear hover anchors.
136
139
  _this.hoverLayer.node = null;
137
140
  }
138
- if (_this.moveIn.hoverNode) {
139
- _this.hoverLayer.node = _this.moveIn.hoverNode;
141
+ if (hoverNode) {
142
+ _this.hoverLayer.node = hoverNode;
140
143
  // Send a move event.
141
- _this.dispatch('moveInNode', _this.moveIn.hoverNode);
142
- _this.showTip(_this.moveIn.hoverNode, pos);
144
+ _this.dispatch('moveInNode', hoverNode);
145
+ _this.showTip(hoverNode, pos);
143
146
  // _this.showTipText(_this.moveIn.hoverNode, pos);
144
147
  }
145
148
  }
@@ -158,16 +161,28 @@ var Topology = (function (_super) {
158
161
  } else if (_this.hoverLayer.hoverLineCP) {
159
162
  _this.hoverLayer.hoverLineCP = null;
160
163
  }
161
- if (_this.moveIn.hoverNode !== _this.lastHoverNode ||
162
- _this.moveIn.type === _this.moveInType.HoverAnchors ||
163
- _this.hoverLayer.lasthoverLineCP !== _this.hoverLayer.hoverLineCP) {
164
+ if (hoverNode !== _this.lastHoverNode ||
165
+ _this.moveIn.type === _this.moveInType.HoverAnchors ||
166
+ _this.hoverLayer.lasthoverLineCP !== _this.hoverLayer.hoverLineCP) {
164
167
  _this.hoverLayer.lasthoverLineCP = _this.hoverLayer.hoverLineCP;
165
168
  _this.render();
166
169
  }
167
170
  _this.scheduledAnimationFrame = false;
171
+ const lastHoverOrder = _this.lastHoverNode && _this.lastHoverNode.order;
172
+ if(hoverNode && (_this.moveIn.type === _this.moveInType.Nodes) && hoverNode.order !== lastHoverOrder){
173
+ // 鼠标hover元件之上,改变背景色
174
+ _this.hoverChangeFollowOperation(_this.moveIn.hoverNode, _this.lastHoverNode);
175
+ }
176
+ if(_this.moveIn.type === _this.moveInType.None) {
177
+ // 鼠标离开元件,还原背景色
178
+ const run = _this.hoverChangeDeacidizing();
179
+ run && _this.render();
180
+ }
181
+ _this.moveIn.leaveFile = false;
168
182
  return;
169
183
  }
170
184
  // Move out parent element.
185
+ _this.hideTip();
171
186
  var moveOutX = pos.x + 50 > _this.store.parentElem.clientWidth + _this.store.parentElem.scrollLeft;
172
187
  var moveOutY = pos.y + 50 > _this.store.parentElem.clientHeight + _this.store.parentElem.scrollTop;
173
188
  if (!_this.store.options.disableMoveOutParent && (moveOutX || moveOutY)) {
@@ -196,7 +211,7 @@ var Topology = (function (_super) {
196
211
  if ((moveLeft || moveTop)) {
197
212
  _this.scroll(moveLeft ? -100 : 0, moveTop ? -100 : 0);
198
213
  }
199
- //console.log('_this.moveIn.type----', _this.moveIn.type)
214
+ // console.log('_this.moveIn.type----', _this.moveIn.type)
200
215
  switch (_this.moveIn.type) {
201
216
  case _this.moveInType.None:
202
217
  _this.hoverLayer.dragRect = new Rect(_this.mouseDown.x, _this.mouseDown.y, pos.x - _this.mouseDown.x, pos.y - _this.mouseDown.y);
@@ -347,7 +362,7 @@ var Topology = (function (_super) {
347
362
  _this.moveIn.hoverLine.controlPoints[_this.moveIn.lineControlPoint.id].y = pos.y;
348
363
  _this.moveIn.hoverLine.textRect = null;
349
364
  if (drawLineFns[_this.moveIn.hoverLine.name] &&
350
- drawLineFns[_this.moveIn.hoverLine.name].dockControlPointFn) {
365
+ drawLineFns[_this.moveIn.hoverLine.name].dockControlPointFn) {
351
366
  drawLineFns[_this.moveIn.hoverLine.name].dockControlPointFn(_this.moveIn.hoverLine.controlPoints[_this.moveIn.lineControlPoint.id], _this.moveIn.hoverLine);
352
367
  }
353
368
  _this.needCache = true;
@@ -384,14 +399,14 @@ var Topology = (function (_super) {
384
399
  return
385
400
  } else {
386
401
  switch (_this.moveIn.type) {
387
- // Click the space.
402
+ // Click the space.
388
403
  case _this.moveInType.None:
389
404
  _this.activeLayer.clear();
390
405
  _this.hoverLayer.clear();
391
406
  _this.pageListAndPageInputHide();
392
407
  _this.dispatch('space', _this.mouseDown);
393
408
  break;
394
- // Click a line.
409
+ // Click a line.
395
410
  case _this.moveInType.Line:
396
411
  case _this.moveInType.LineControlPoint:
397
412
  if (e.ctrlKey || e.shiftKey) {
@@ -407,7 +422,7 @@ var Topology = (function (_super) {
407
422
  if (_this.store.data.locked || _this.moveIn.hoverLine.locked) {
408
423
  _this.moveIn.hoverLine.click();
409
424
  }
410
- // tslint:disable-next-line:no-switch-case-fall-through
425
+ // tslint:disable-next-line:no-switch-case-fall-through
411
426
  case _this.moveInType.LineFrom:
412
427
  case _this.moveInType.LineTo:
413
428
  _this.activeLayer.pens = [_this.moveIn.hoverLine];
@@ -436,14 +451,14 @@ var Topology = (function (_super) {
436
451
  line: _this.hoverLayer.line,
437
452
  });
438
453
  }
439
- // tslint:disable-next-line:no-switch-case-fall-through
454
+ // tslint:disable-next-line:no-switch-case-fall-through
440
455
  case _this.moveInType.Nodes:
441
456
  if (!_this.moveIn.activeNode) {
442
457
  break;
443
458
  }
444
459
  if (e.ctrlKey || e.shiftKey) {
445
460
  if (_this.moveIn.hoverNode &&
446
- _this.activeLayer.hasInAll(_this.moveIn.hoverNode)) {
461
+ _this.activeLayer.hasInAll(_this.moveIn.hoverNode)) {
447
462
  _this.activeLayer.setPens([_this.moveIn.hoverNode]);
448
463
  _this.dispatch('node', _this.moveIn.hoverNode);
449
464
  } else if (!_this.activeLayer.has(_this.moveIn.activeNode)) {
@@ -490,6 +505,12 @@ var Topology = (function (_super) {
490
505
  _this.dispatch('node', activeNode);
491
506
  }
492
507
  }
508
+ }else {
509
+ // 存在多个选中元件时,如果点击选中区域外则取消多个元件的选中
510
+ if(!_this.moveIn.sizeCPs){
511
+ _this.activeLayer.setPens([_this.moveIn.activeNode]);
512
+ _this.dispatch('node', _this.moveIn.activeNode);
513
+ }
493
514
  }
494
515
  if (_this.store.data.locked || _this.moveIn.activeNode.locked) {
495
516
  _this.moveIn.activeNode.click();
@@ -510,7 +531,10 @@ var Topology = (function (_super) {
510
531
  }
511
532
  if (!_this.mouseDown)
512
533
  return;
513
- _this.clipboard = null;
534
+ if(_this.moveIn.hoverNode) {
535
+ _this.showTip(_this.moveIn.hoverNode, _this.pos);
536
+ _this.pos = null;
537
+ }
514
538
  _this.mouseDown = null;
515
539
  _this.lastTranlated.x = 0;
516
540
  _this.lastTranlated.y = 0;
@@ -525,7 +549,7 @@ var Topology = (function (_super) {
525
549
  }
526
550
  } else {
527
551
  switch (_this.moveIn.type) {
528
- // Add the line.
552
+ // Add the line.
529
553
  case _this.moveInType.HoverAnchors:
530
554
 
531
555
  // New active.
@@ -537,8 +561,8 @@ var Topology = (function (_super) {
537
561
  } else {
538
562
  var lines = _this.store.data.pens.filter(function (pen) {
539
563
  return pen.type === PenType.Line &&
540
- pen.from.isSameAs(_this.hoverLayer.line.from) &&
541
- pen.to.isSameAs(_this.hoverLayer.line.to);
564
+ pen.from.isSameAs(_this.hoverLayer.line.from) &&
565
+ pen.to.isSameAs(_this.hoverLayer.line.to);
542
566
  });
543
567
  willAddLine = lines.length <= 1;
544
568
  }
@@ -565,7 +589,7 @@ var Topology = (function (_super) {
565
589
  case _this.moveInType.LineFrom:
566
590
  case _this.moveInType.LineTo:
567
591
  if (_this.hoverLayer.line.disableEmptyLine &&
568
- (!_this.hoverLayer.line.from.id || !_this.hoverLayer.line.to.id)) {
592
+ (!_this.hoverLayer.line.from.id || !_this.hoverLayer.line.to.id)) {
569
593
  _this.needCache = true;
570
594
  _this.activeLayer.clear();
571
595
  _this.store.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
@@ -582,8 +606,8 @@ var Topology = (function (_super) {
582
606
  };
583
607
  _this.onkeydown = function (key) {
584
608
  if (_this.store && _this.store.data.locked ||
585
- key.target.tagName === 'INPUT' ||
586
- key.target.tagName === 'TEXTAREA') {
609
+ key.target.tagName === 'INPUT' ||
610
+ key.target.tagName === 'TEXTAREA') {
587
611
  return;
588
612
  }
589
613
  var done = false;
@@ -636,12 +660,14 @@ var Topology = (function (_super) {
636
660
  break;
637
661
  case 'c':
638
662
  case 'C':
639
- const copyState = _this.copy();
640
- if(!copyState) _this.dispatch('copyNone');
663
+ if (key.ctrlKey) {
664
+ const copyState = _this.copy();
665
+ if(!copyState) _this.dispatch('copyNone');
666
+ }
641
667
  break;
642
668
  case 'v':
643
669
  case 'V':
644
- _this.paste();
670
+ if (key.ctrlKey) _this.paste();
645
671
  break;
646
672
  case 'y':
647
673
  case 'Y':
@@ -651,11 +677,8 @@ var Topology = (function (_super) {
651
677
  break;
652
678
  case 'z':
653
679
  case 'Z':
654
- if (key.shiftKey) {
655
- _this.redo();
656
- } else {
657
- _this.undo();
658
- }
680
+ if (key.shiftKey) _this.redo();
681
+ if (key.ctrlKey) _this.undo();
659
682
  break;
660
683
  case 'g':
661
684
  case 'G':
@@ -691,9 +714,8 @@ var Topology = (function (_super) {
691
714
  _this.divLayer.canvas.ondrop = function (event) {
692
715
  try {
693
716
  var json = event.dataTransfer.getData('Topology') ||
694
- event.dataTransfer.getData('Text');
695
- if (!json)
696
- return;
717
+ event.dataTransfer.getData('Text');
718
+ if (!json) return;
697
719
  var obj = JSON.parse(json);
698
720
  event.preventDefault();
699
721
  if(obj.type && obj.type === 'temp') {
@@ -889,15 +911,10 @@ var Topology = (function (_super) {
889
911
 
890
912
  if (json.name == 'define') {
891
913
  // console.log('创建自定义组件 ', json);
892
- console.log('store 中的 自定义 ', Store.get('defineNode'));
914
+ console.log('store 中的 自定义 ');
893
915
  _this.dropDefineNode(json, offsetX, offsetY);
894
- } else if(json.name === 'temp') {
895
- // 温湿度元件
896
- _this.dropTempNode(json);
897
- }else {
916
+ } else {
898
917
  var node = new Node(json);
899
- if(node.name === 'echarts') node.dash = 4;
900
- if(node.name === 'iframe') node.iframe = 'http://www.yingzeshiji.com.cn/'; // 默认展示盈泽世纪官网
901
918
  node.setTID(_this.id);
902
919
  node.clearChildrenIds();
903
920
  _this.addNode(node, true);
@@ -934,38 +951,14 @@ var Topology = (function (_super) {
934
951
  }
935
952
  this.switchStaticsCheckType(node, {dcimStaticForType: 'SH'});
936
953
  };
937
- // 添加温湿度元件
938
- Topology.prototype.dropTempNode = function(json) {
939
- const nodeChildren = json.children;
940
- delete json['children'];
941
- const node = this.setNodeData(json);
942
- const combinTempData = [];
943
- let nodeX = node.rect.x;
944
- let nodeY = node.rect.y;
945
- for (let i = 0; i < nodeChildren.length; i++) {
946
- const childNode = this.setNodeData(nodeChildren[i]);
947
- childNode.rect.x = i === 0 ? nodeX : nodeX + childNode.rect.width / 2;
948
- childNode.rect.y = i === 2 ? nodeY + childNode.rect.height + 1 : nodeY;
949
- childNode.rect.center = {
950
- x: childNode.rect.x + childNode.rect.width / 2,
951
- y: childNode.rect.y + childNode.rect.height / 2
952
- }
953
- childNode.rect.ex = childNode.rect.x + childNode.rect.width;
954
- childNode.rect.ey = childNode.rect.y + childNode.rect.height;
955
- combinTempData.push(childNode);
956
- }
957
- this.combine(combinTempData, null, 'temp');
958
- this.render();
959
- this.cache();
960
- };
961
954
  // 添加自定义元件
962
955
  Topology.prototype.dropDefineNode = function(josn, offsetX, offsetY) {
963
956
  var _this = this;
964
957
  if (_this.store.data.locked) return
965
958
  // let defineNode = Store.get('defineNode');
966
959
  // let nodesList = Store.get('defineNode').pens;
967
- let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
968
- let nodesList = defineNode.pens;
960
+ // let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
961
+ let nodesList = josn.pens;
969
962
 
970
963
  let renderNodesList = [];
971
964
 
@@ -979,7 +972,7 @@ var Topology = (function (_super) {
979
972
 
980
973
  node.setTID(s8());
981
974
  node.id = s8();
982
- node.fileId = defineNode.fileId;
975
+ node.fileId = josn.fileId;
983
976
 
984
977
  // console.log('push之前的node', node);
985
978
 
@@ -997,7 +990,7 @@ var Topology = (function (_super) {
997
990
 
998
991
  _this.dispatch('addNode', renderNodesList[0]);
999
992
  };
1000
- Topology.prototype.addNode = function (node, focus, visit) {
993
+ Topology.prototype.addNode = function (node, focus, visit, cache) {
1001
994
  if (focus === void 0) {
1002
995
  focus = false;
1003
996
  }
@@ -1026,12 +1019,12 @@ var Topology = (function (_super) {
1026
1019
  if (focus) {
1027
1020
  this.render();
1028
1021
  this.animate(true);
1029
- this.cache();
1030
1022
  if(!visit) {
1031
1023
  this.activeLayer.setPens([node]);
1032
1024
  this.dispatch('addNode', node);
1033
1025
  }
1034
1026
  }
1027
+ !cache && this.cache();
1035
1028
  return node;
1036
1029
  };
1037
1030
  Topology.prototype.addLine = function (line, focus) {
@@ -1064,11 +1057,11 @@ var Topology = (function (_super) {
1064
1057
  this.store.parentElem.scrollTop = 0;
1065
1058
  this.caches.list = [];
1066
1059
  this.divLayer.clear();
1067
- this.cache();
1068
1060
  this.overflow();
1069
1061
  this.render(true);
1070
1062
  this.animate(true);
1071
1063
  this.showGrid();
1064
+ this.cache();
1072
1065
  };
1073
1066
  Topology.prototype.overflow = function () {
1074
1067
  try {
@@ -1095,28 +1088,30 @@ var Topology = (function (_super) {
1095
1088
  this.moveIn.hoverNode = null;
1096
1089
  this.moveIn.lineControlPoint = null;
1097
1090
  this.moveIn.hoverLine = null;
1091
+ this.moveIn.sizeCPs = false;
1098
1092
  this.hoverLayer.hoverAnchorIndex = -1;
1099
1093
  if (!this.store.data.locked &&
1100
- !(this.activeLayer.pens.length === 1 && this.activeLayer.pens[0].type) &&
1101
- !this.activeLayer.locked() &&
1102
- this.activeLayer.rotateCPs[0] &&
1103
- this.activeLayer.rotateCPs[0].hit(pt, 15)) {
1094
+ !(this.activeLayer.pens.length === 1 && this.activeLayer.pens[0].type) &&
1095
+ !this.activeLayer.locked() &&
1096
+ this.activeLayer.rotateCPs[0] &&
1097
+ this.activeLayer.rotateCPs[0].hit(pt, 15)) {
1104
1098
  this.moveIn.type = this.moveInType.Rotate;
1105
1099
  var cursor = this.store.options.rotateCursor;
1106
1100
  this.divLayer.canvas.style.cursor = cursor.includes('/')
1107
- ? "url(\"" + cursor + "\"), auto"
1108
- : cursor;
1101
+ ? "url(\"" + cursor + "\"), auto"
1102
+ : cursor;
1109
1103
  return;
1110
1104
  }
1111
1105
  if (this.activeLayer.pens.length > 1 &&
1112
- pointInRect(pt, this.activeLayer.sizeCPs)) {
1106
+ pointInRect(pt, this.activeLayer.sizeCPs)) {
1113
1107
  this.moveIn.type = this.moveInType.Nodes;
1108
+ this.moveIn.sizeCPs = true;
1114
1109
  }
1115
1110
  if (!this.store.data.locked &&
1116
- !this.activeLayer.locked() &&
1117
- !this.store.options.hideSizeCP) {
1111
+ !this.activeLayer.locked() &&
1112
+ !this.store.options.hideSizeCP) {
1118
1113
  if (this.activeLayer.pens.length > 1 ||
1119
- (!this.activeLayer.pens[0].type && !this.activeLayer.pens[0].hideSizeCP)) {
1114
+ (!this.activeLayer.pens[0].type && !this.activeLayer.pens[0].hideSizeCP)) {
1120
1115
  for (var i = 0; i < this.activeLayer.sizeCPs.length; ++i) {
1121
1116
  if (this.activeLayer.sizeCPs[i].hit(pt, 10)) {
1122
1117
  this.moveIn.type = this.moveInType.ResizeCP;
@@ -1127,7 +1122,7 @@ var Topology = (function (_super) {
1127
1122
  }
1128
1123
  }
1129
1124
  }
1130
- // In active pen.
1125
+ // In active pen.
1131
1126
  if (!this.store.data.locked) {
1132
1127
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1133
1128
  var item = _a[_i];
@@ -1152,31 +1147,32 @@ var Topology = (function (_super) {
1152
1147
  this.divLayer.canvas.style.cursor = 'default';
1153
1148
  var len = this.store.data.pens.length;
1154
1149
  for (var i = len - 1; i > -1; --i) {
1155
- if(this.store.data.pens[i].visible || this.store.data.pens[i].visibleSwitch){
1156
- if (this.store.data.pens[i].type === PenType.Node &&
1157
- this.inNode(pt, this.store.data.pens[i])) {
1150
+ const node = this.store.data.pens[i];
1151
+ node.order = i;
1152
+ if(node.visible || node.visibleSwitch){
1153
+ if (node.type === PenType.Node && this.inNode(pt, node)) {
1158
1154
  return;
1159
- } else if (this.store.data.pens[i].type === PenType.Line &&
1160
- this.inLine(pt, this.store.data.pens[i])) {
1155
+ } else if (node.type === PenType.Line && this.inLine(pt, node)) {
1161
1156
  // 需要优先判断十分在节点锚点上
1162
1157
  // return;
1163
1158
  }
1164
1159
  }
1165
1160
  }
1166
1161
  };
1167
- Topology.prototype.inChildNode = function (pt, children) {
1162
+ Topology.prototype.inChildNode = function (pt, children, order) {
1168
1163
  if (!children) {
1169
1164
  return null;
1170
1165
  }
1171
1166
  for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
1172
1167
  var item = children_1[_i];
1168
+ item.order = order;
1173
1169
  if (item.type === PenType.Line) {
1174
1170
  if (this.inLine(pt, item)) {
1175
1171
  return item;
1176
1172
  }
1177
1173
  continue;
1178
1174
  }
1179
- var node = this.inChildNode(pt, item.children);
1175
+ var node = this.inChildNode(pt, item.children, order);
1180
1176
  if (node) {
1181
1177
  return node;
1182
1178
  }
@@ -1192,11 +1188,11 @@ var Topology = (function (_super) {
1192
1188
  inChild = false;
1193
1189
  }
1194
1190
  if (this.store.data.locked === Lock.NoEvent ||
1195
- (!node.visible && !window.location.pathname.includes('workspace')) ||
1196
- node.locked === Lock.NoEvent) {
1191
+ (!node.visible && !window.location.pathname.includes('workspace')) ||
1192
+ node.locked === Lock.NoEvent) {
1197
1193
  return null;
1198
1194
  }
1199
- var child = this.inChildNode(pt, node.children);
1195
+ var child = this.inChildNode(pt, node.children, node.order);
1200
1196
  if (child) {
1201
1197
  if (this.moveIn.type !== this.moveInType.HoverAnchors) {
1202
1198
  if (child.type === PenType.Line) {
@@ -1226,15 +1222,15 @@ var Topology = (function (_super) {
1226
1222
  }
1227
1223
  // Too small
1228
1224
  if (!this.store.data.locked &&
1229
- !node.locked &&
1230
- !(this.store.options.hideAnchor ||
1231
- node.hideAnchor ||
1232
- node.rect.width < 20 ||
1233
- node.rect.height < 20)) {
1225
+ !node.locked &&
1226
+ !(this.store.options.hideAnchor ||
1227
+ node.hideAnchor ||
1228
+ node.rect.width < 20 ||
1229
+ node.rect.height < 20)) {
1234
1230
  for (var j = 0; j < node.rotatedAnchors.length; ++j) {
1235
1231
  if (node.rotatedAnchors[j].hit(pt, 5)) {
1236
1232
  if (!this.mouseDown &&
1237
- node.rotatedAnchors[j].mode === AnchorMode.In) {
1233
+ node.rotatedAnchors[j].mode === AnchorMode.In) {
1238
1234
  continue;
1239
1235
  }
1240
1236
  this.moveIn.type = this.moveInType.HoverAnchors;
@@ -1251,16 +1247,16 @@ var Topology = (function (_super) {
1251
1247
  return node;
1252
1248
  }
1253
1249
  if (this.store.options.hideAnchor ||
1254
- node.hideAnchor ||
1255
- this.store.data.locked ||
1256
- node.locked) {
1250
+ node.hideAnchor ||
1251
+ this.store.data.locked ||
1252
+ node.locked) {
1257
1253
  return null;
1258
1254
  }
1259
1255
  if (node.hit(pt, 5)) {
1260
1256
  for (var j = 0; j < node.rotatedAnchors.length; ++j) {
1261
1257
  if (node.rotatedAnchors[j].hit(pt, 5)) {
1262
1258
  if (!this.mouseDown &&
1263
- node.rotatedAnchors[j].mode === AnchorMode.In) {
1259
+ node.rotatedAnchors[j].mode === AnchorMode.In) {
1264
1260
  continue;
1265
1261
  }
1266
1262
  this.moveIn.hoverNode = node;
@@ -1322,7 +1318,7 @@ var Topology = (function (_super) {
1322
1318
  }
1323
1319
  for (var i = 0; i < item.rotatedAnchors.length; ++i) {
1324
1320
  if (item.rotatedAnchors[i].mode &&
1325
- item.rotatedAnchors[i].mode !== AnchorMode.In) {
1321
+ item.rotatedAnchors[i].mode !== AnchorMode.In) {
1326
1322
  continue;
1327
1323
  }
1328
1324
  if (item.rotatedAnchors[i].hit(point, 10)) {
@@ -1440,8 +1436,8 @@ var Topology = (function (_super) {
1440
1436
  for (var _b = 0, _c = this.store.data.pens; _b < _c.length; _b++) {
1441
1437
  var item = _c[_b];
1442
1438
  if (!(item instanceof Node) ||
1443
- this.activeLayer.has(item) ||
1444
- item.name === 'text') {
1439
+ this.activeLayer.has(item) ||
1440
+ item.name === 'text') {
1445
1441
  continue;
1446
1442
  }
1447
1443
  if (!item.dockWatchers) {
@@ -1510,10 +1506,9 @@ var Topology = (function (_super) {
1510
1506
  }
1511
1507
  this.divLayer.clear();
1512
1508
  var data = JSON.parse(JSON.stringify(this.caches.list[--this.caches.index]));
1513
- this.store.data.pens.splice(0, this.store.data.pens.length);
1514
- this.store.data.pens.push.apply(this.store.data.pens, data.pens);
1515
- this.render(true);
1509
+ this.store.data.pens = [...data.pens];
1516
1510
  this.divLayer.render();
1511
+ this.render(true);
1517
1512
  if (noRedo) {
1518
1513
  this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
1519
1514
  }
@@ -1525,10 +1520,9 @@ var Topology = (function (_super) {
1525
1520
  }
1526
1521
  this.divLayer.clear();
1527
1522
  var data = JSON.parse(JSON.stringify(this.caches.list[++this.caches.index]));
1528
- this.store.data.pens.splice(0, this.store.data.pens.length);
1529
- this.store.data.pens.push.apply(this.store.data.pens, data.pens);
1530
- this.render(true);
1523
+ this.store.data.pens = [...data.pens];
1531
1524
  this.divLayer.render();
1525
+ this.render(true);
1532
1526
  this.dispatch('redo', this.store.data);
1533
1527
  };
1534
1528
  Topology.prototype.toImage = function (type, quality, callback, padding, thumbnail) {
@@ -1560,7 +1554,11 @@ var Topology = (function (_super) {
1560
1554
  canvas.height = srcRect.height;
1561
1555
  canvas.style.width = rect.width + 'px';
1562
1556
  canvas.style.height = rect.height + 'px';
1563
- var ctx = canvas.getContext('2d');
1557
+ var ctx = canvas.getContext('2d', {
1558
+ alpha: false,
1559
+ desynchronized: true,
1560
+ willReadFrequently: false
1561
+ });
1564
1562
  if (type && type !== 'image/png') {
1565
1563
  ctx.fillStyle = '#fff';
1566
1564
  ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -1608,6 +1606,7 @@ var Topology = (function (_super) {
1608
1606
  if (this.store.options.disableEmptyLine) {
1609
1607
  this.delEmptyLines(pen.id);
1610
1608
  }
1609
+ if(pen.isPointMonitor) this.deletePointAssociationIconData(pen.id);
1611
1610
  pens.push.apply(pens, this.store.data.pens.splice(found, 1));
1612
1611
  // this.setSwitchTabData(pen, found, 'delete');
1613
1612
  --i;
@@ -1622,6 +1621,13 @@ var Topology = (function (_super) {
1622
1621
  this.cache();
1623
1622
  this.dispatch('delete', pens);
1624
1623
  };
1624
+ // 删除点位监控元件关联的小图标
1625
+ Topology.prototype.deletePointAssociationIconData = function (id) {
1626
+ const dataPool = bindDataWithIconAssociationPool;
1627
+ if(!dataPool.size || !dataPool.has(id)) return;
1628
+ const iconOrder = dataPool.get(dataPool.get(id).cid).order;
1629
+ this.store.data.pens.splice(iconOrder, 1);
1630
+ };
1625
1631
  Topology.prototype.resetAssociateDateData = function (dateIds) {
1626
1632
  // 重置关联日期数据的元件属性值
1627
1633
  const pens = this.store.data.pens;
@@ -1640,9 +1646,9 @@ var Topology = (function (_super) {
1640
1646
  }
1641
1647
  var line = this.store.data.pens[i];
1642
1648
  if (!line.from.id ||
1643
- !line.to.id ||
1644
- line.from.id === deleteedId ||
1645
- line.to.id === deleteedId) {
1649
+ !line.to.id ||
1650
+ line.from.id === deleteedId ||
1651
+ line.to.id === deleteedId) {
1646
1652
  this.store.data.pens.splice(i, 1);
1647
1653
  this.animateLayer.pens.delete(line.id);
1648
1654
  --i;
@@ -1695,52 +1701,66 @@ var Topology = (function (_super) {
1695
1701
  this.render();
1696
1702
  this.dispatch('delete', this.clipboard.pens);
1697
1703
  };
1698
- Topology.prototype.copy = function () {
1704
+ Topology.prototype.copy = function (type) {
1699
1705
  let isAnimate = this.activeLayer.pens.find((item) => {
1700
1706
  return item.animatePlay;
1701
1707
  });
1702
1708
  if(isAnimate) return false;
1703
- this.clipboard = {
1704
- pens: [],
1705
- };
1709
+ if (type === 'paste') {
1710
+ // 粘贴:保留 initPens,为空则取 pens
1711
+ this.clipboard = {
1712
+ initPens: this.clipboard.initPens || this.clipboard.pens,
1713
+ pens: []
1714
+ };
1715
+ } else {
1716
+ // 非粘贴:保存初始区域 + 重置剪贴板
1717
+ if (this.activeLayer.pens.length > 1) this.activeLayer.initialSizeCPs = [...this.activeLayer.sizeCPs];
1718
+ this.clipboard = {
1719
+ pens: []
1720
+ };
1721
+ }
1706
1722
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1707
1723
  var pen = _a[_i];
1708
1724
  this.clipboard.pens.push(pen.clone());
1709
1725
  };
1710
1726
  return true;
1711
1727
  };
1712
- Topology.prototype.paste = function () {
1713
- if (!this.clipboard || this.store.data.locked) {
1714
- return;
1715
- }
1728
+ Topology.prototype.paste = function (position) {
1729
+ if (!this.clipboard || this.store.data.locked) return;
1716
1730
  this.hoverLayer.node = null;
1717
1731
  this.hoverLayer.line = null;
1718
1732
  this.activeLayer.pens = [];
1719
1733
  var idMaps = {};
1720
- const clipboardPens = JSON.parse(JSON.stringify(this.clipboard.pens));
1721
- for (var _i = 0, _a = clipboardPens; _i < _a.length; _i++) {
1722
- const pen = new Node(_a[_i]);
1723
- if (pen.type === PenType.Node) {
1734
+ const { pens: clipPens, cpx, options } = this.clipboard;
1735
+
1736
+ // 计算中心点
1737
+ if (!cpx && clipPens.length > 1 && position) this.clipboard.cpx = this.activeLayer.getCenterPoints();
1738
+
1739
+ const targetPens = position ? (this.clipboard.initPens || clipPens) : clipPens;
1740
+ const clipboardPens = JSON.parse(JSON.stringify(targetPens));
1741
+
1742
+ for (const [i, list] of clipboardPens.entries()) {
1743
+ list.isBind && this.activeLayer.clear();
1744
+ let pen = {};
1745
+ if (list.type === PenType.Node) {
1746
+ pen = new Node(list);
1724
1747
  this.newId(pen, idMaps);
1725
- pen.rect.x += 20;
1726
- pen.rect.ex += 20;
1727
- pen.rect.y += 20;
1728
- pen.rect.ey += 20;
1729
- const rectType = ['rect', 'textRect', 'fullTextRect', 'iconRect', 'fullIconRect']
1730
- if (pen.subName && pen.subName == 'temp') {
1731
- // 温湿度元件
1732
- rectType.forEach((type) => {
1733
- pen.children.forEach((item) => {
1734
- item[type].x += 20;
1735
- item[type].ex += 20;
1736
- item[type].y += 20;
1737
- item[type].ey += 20;
1738
- })
1739
- })
1748
+ this.resetRect(position, this.clipboard.cpx, pen.rect);
1749
+ // 温湿度/温度节点初始化
1750
+ const isSpecialNode = ['temp', 'humiture'].includes(pen.subName);
1751
+ if (isSpecialNode && drawNodeFns[pen.subName]) drawNodeFns[pen.subName](null, pen, true);
1752
+
1753
+ pen.init();
1754
+
1755
+ // 绑定数据:自动生成折线图标
1756
+ if (list.isBind && options[i]) {
1757
+ const { type, node, bindName, count } = options[i];
1758
+ if (type !== dataBindType.ASSET) pen.text = pen.isAlias ? bindName : pen.defaultText;
1759
+ pen.isPointMonitor && this.bindWithIconAssociation(type, pen, node, i + 1, count);
1740
1760
  }
1741
- //pen.init();
1742
1761
  }
1743
- if (pen instanceof Line) {
1762
+ if (list.type === PenType.Line) {
1763
+ pen = new Line(list);
1744
1764
  pen.id = s8();
1745
1765
  pen.from = new Point(pen.from.x + 20, pen.from.y + 20, pen.from.direction, pen.from.anchorIndex, idMaps[pen.from.id]);
1746
1766
  pen.to = new Point(pen.to.x + 20, pen.to.y + 20, pen.to.direction, pen.to.anchorIndex, idMaps[pen.to.id]);
@@ -1759,7 +1779,7 @@ var Topology = (function (_super) {
1759
1779
  this.render();
1760
1780
  this.animate(true);
1761
1781
  this.cache();
1762
- this.copy();
1782
+ !position && this.copy('paste'); // 非鼠标右键的粘贴才执行拷贝
1763
1783
  if (this.clipboard.pens.length > 1) {
1764
1784
  this.dispatch('multi', {
1765
1785
  pens: this.clipboard.pens,
@@ -1772,90 +1792,162 @@ var Topology = (function (_super) {
1772
1792
  }
1773
1793
  }
1774
1794
  };
1775
- Topology.prototype.bind = function (item, exite, dataType, index) {
1776
- this.clipboard = {
1777
- pens: [],
1778
- };
1779
- for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1780
- var pen = _a[_i];
1781
- pen.data = [];
1782
- this.bindInfo(item, pen, dataType, index, exite);
1783
- this.clipboard.pens.push(pen.clone());
1795
+ // 重置元件偏移位置
1796
+ Topology.prototype.resetRect = function (position, cpx, rect) {
1797
+ if(!position) {
1798
+ rect.x += 20;
1799
+ rect.y += 20;
1800
+ }else if(!cpx && position) {
1801
+ rect.x = position.x;
1802
+ rect.y = position.y;
1803
+ }else if(cpx && position) {
1804
+ rect.x = rect.x + (position.x - cpx.x);
1805
+ rect.y = rect.y + (position.y - cpx.y);
1806
+ }
1807
+ rect.init();
1808
+ };
1809
+ /**
1810
+ * 绑定数据
1811
+ * @param data 绑定的数据 Array
1812
+ * @param type 绑定的数据类型 Number
1813
+ * @param batch 批量绑定 Boolean
1814
+ */
1815
+ Topology.prototype.bind = function (data, type, batch) {
1816
+ const pen = this.activeLayer.pens[0];
1817
+ const boundData = new Set();
1818
+ // 获取已绑定的数据标识
1819
+ const targetKeys = new Set(['tagId', 'kpiAddr', 'assetId', 'areaId', 'varId', 'branchVal']);
1820
+ if(pen.data && pen.data.length) {
1821
+ for (const node of pen.data) {
1822
+ if (targetKeys.has(node.key)) boundData.add(node.value);
1823
+ }
1824
+ }
1825
+ // 非视频:自动添加 MQTT 事件
1826
+ if(type !== dataBindType.VIDEO) {
1827
+ // 除 视频绑定外的其他数据绑定后,自动添加mqtt事件
1828
+ const hasMqtt = pen.events.find((ev) => { return ev.type === 3 });
1829
+ if(!hasMqtt) pen.events.push({ type: 3, action: 2, value: '', show: true });
1830
+ }
1831
+ let result = [];
1832
+ // 剪贴板数据初始化
1833
+ this.clipboard = { pens: [], options: [], cpx: null, initPens: null };
1834
+ for (const [i, item] of data.entries()) {
1835
+
1836
+ if (hasBoundData(boundData, item, type)) continue; // 如果已绑定该数据则跳过
1837
+
1838
+ const options = bindDataConfig(item, type);
1839
+ // 赋值标题、事件
1840
+ if(options.title) pen.title = options.title;
1841
+ if(options.events.length) pen.events = options.events;
1842
+ // 赋值子级
1843
+ if(options.children.length) {
1844
+ pen.children.forEach((sub, c) => {
1845
+ const subNode = options.children[c];
1846
+ if(!subNode) return;
1847
+ sub.data = subNode.data;
1848
+ sub.events = subNode.events;
1849
+ });
1850
+ }
1851
+
1852
+ if(batch && i !== 0) {
1853
+ // 批量绑定数据
1854
+ const clonePen = pen.clone();
1855
+ clonePen.isBind = true;
1856
+ clonePen.data = [...options.data];
1857
+ clonePen.rect.x += 20 * (i-1);
1858
+ clonePen.rect.y += 20 * (i-1);
1859
+
1860
+ this.clipboard.pens.push(clonePen);
1861
+ this.clipboard.options.push({
1862
+ node: item.default || item,
1863
+ count: length - 1,
1864
+ bindName: options.bindName,
1865
+ type
1866
+ });
1867
+ }else {
1868
+ // 单个绑定数据
1869
+ result = [...pen.data, ...options.data];
1870
+ if(type !== dataBindType.asset) pen.text = pen.isAlias ? options.bindName : pen.defaultText;
1871
+ }
1872
+ }
1873
+ if(result.length) {
1874
+ pen.data = result;
1875
+ pen.isPointMonitor && this.bindWithIconAssociation(type, pen, data[0].default || data[0], 0, 0); // 点位监控 自动生成折线小图标;
1876
+ }
1877
+ // 批量粘贴
1878
+ this.clipboard.pens.length && this.paste();
1879
+ };
1880
+ /**
1881
+ * 绑定数据关联图标的操作
1882
+ * @param type 绑定的数据类型
1883
+ * @param pen 元件的节点数据
1884
+ * @param data 绑定的节点数据
1885
+ * @param index 批量绑定时的数据索引
1886
+ * @param count 对应索引下标的总数据
1887
+ */
1888
+ Topology.prototype.bindWithIconAssociation = function (type, pen, data, index, count) {
1889
+ const dataPool = bindDataWithIconAssociationPool;
1890
+ if(dataPool.has(pen.id)){
1891
+ // 修改绑定的数据
1892
+ const iconId = dataPool.get(pen.id).cid;
1893
+ const iconEvents = this.store.data.pens[dataPool.get(iconId).order].events;
1894
+ iconEvents.forEach((ev) => {
1895
+ setConfBindPointMonitorData(type, ev, data);
1896
+ })
1897
+ }else {
1898
+ // 添加绑定的数据
1899
+ const iconData = createEchartsLineIcon(type, pen, data);
1900
+ const newNode = this.setNodeData(iconData);
1901
+ const pencx = pen.rect.center.x,
1902
+ pency = pen.rect.center.y,
1903
+ iconcx = newNode.rect.center.x,
1904
+ iconcy = newNode.rect.center.y;
1905
+ // 存储矩形偏移及关联信息
1906
+ dataPool.set(pen.id, {
1907
+ cid: newNode.id,
1908
+ order: -1,
1909
+ cx: pencx,
1910
+ cy: pency,
1911
+ dx: iconcx - pencx, // 图标中心点与矩形中心点的距离,固定不变
1912
+ dy: iconcy - pency // 图标中心点与矩形中心点的距离,固定不变
1913
+ });
1914
+ // 存储图标偏移及关联信息
1915
+ dataPool.set(newNode.id, {
1916
+ cid: pen.id,
1917
+ order: -1,
1918
+ cx: iconcx,
1919
+ cy: iconcy
1920
+ });
1921
+ this.addNode(newNode, index === count, true, true);
1922
+ }
1923
+ };
1924
+ // 设置绑定的点位监控数据与小图标关联
1925
+ Topology.prototype.resetBindWithIconConnectData = function () {
1926
+ const dataPool = bindDataWithIconAssociationPool;
1927
+ if(!dataPool.size) return;
1928
+ for (let i = 0, pen = this.store.data.pens; i < pen.length; i++) {
1929
+ const node = pen[i];
1930
+ if(dataPool.has(node.id)) dataPool.get(node.id).order = i;
1931
+ }
1932
+ };
1933
+ // 元件移动或缩放时,关联的图标也跟随移动改变位置
1934
+ Topology.prototype.resetBindWithIconConnectRect = function (pen) {
1935
+ const dataPool = bindDataWithIconAssociationPool;
1936
+ if(!dataPool.size || !dataPool.has(pen.id)) return;
1937
+ const penData = dataPool.get(pen.id); // 若是图标元件,则penData为icon的预存数据, pen 为icon节点数据
1938
+ if(!pen.isPointMonitor) {
1939
+ // 小图标基本属性变化,重置关联的固定值
1940
+ const node = dataPool.get(penData.cid); // 元件的预存数据。
1941
+ const oldPen = this.store.data.pens[node.order];
1942
+ node.dx = pen.rect.center.x - oldPen.rect.center.x;
1943
+ node.dy = pen.rect.center.y - oldPen.rect.center.y;
1944
+ return;
1784
1945
  }
1785
- if (exite == true) {
1786
- this.paste();
1787
- }
1788
- };
1789
- Topology.prototype.bindInfo = async function (item, pen, type, index, exite) {
1790
- const itemNode = item && item.default || item;
1791
- let bindName = '';
1792
- if ([0, '0'].includes(type)) {
1793
- bindName = itemNode.tagName;
1794
- const setTagId = setTagIdData(itemNode);
1795
- pen.data.push(...setTagId);
1796
- // 绑定悬浮文字
1797
- pen.title = itemNode.touchpname
1798
- //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1799
- const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1800
- pen.data.push(...setThreeCategory);
1801
- } else if ([1, '1'].includes(type)) {
1802
- bindName = itemNode.kpiName;
1803
- const setKpiAddr = setKpiAddrData(itemNode);
1804
- pen.data.push(...setKpiAddr);
1805
- } else if ([2, '2'].includes(type)) {
1806
- bindName = itemNode.name;
1807
- const setAssetId = setAssetIdData(itemNode);
1808
- pen.data.push(...setAssetId);
1809
- // 绑定悬浮文字
1810
- pen.title = itemNode.bak
1811
- if (pen.subName && pen.subName == 'temp') {
1812
- // 温湿度元件
1813
- // 通讯状态
1814
- pen.children[0].data = []
1815
- if (index > 0) {
1816
- pen.children[0].text = index + 1 + '#'
1817
- }
1818
- this.bindInfo(itemNode, pen.children[0], type);
1819
- // 温度
1820
- if(item.temperature) {
1821
- pen.children[1].data = [];
1822
- this.bindInfo(item.temperature, pen.children[1], 0);
1823
- }
1824
- // 湿度
1825
- if(item.dampness) {
1826
- pen.children[2].data = []
1827
- this.bindInfo(item.dampness, pen.children[2], 0);
1828
- }
1829
- pen.children.forEach((itemNode) => {
1830
- itemNode.events = [{
1831
- "type": 3,
1832
- "action": 2,
1833
- "value": "",
1834
- "show": true
1835
- }]
1836
- })
1837
- }
1838
- } else if ([3, '3'].includes(type)) {
1839
- bindName = itemNode.name;
1840
- const setAreaId = setAreaIdData(itemNode);
1841
- pen.data.push(...setAreaId);
1842
- }else if ([4, '4'].includes(type)) {
1843
- bindName = itemNode.name;
1844
- const setVarId = setVarValueData(itemNode);
1845
- pen.data.push(...setVarId);
1846
- }else if ([5, '5'].includes(type)) {
1847
- bindName = itemNode.value;
1848
- const setBranch = setBranchAddressData(itemNode);
1849
- pen.data.push(...setBranch);
1850
- }
1851
- if(typeof exite === 'boolean') pen.text = bindName;
1852
- // if([0, 2, '0', '2'].includes(type)) {
1853
- // //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1854
- // const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1855
- //
1856
- // pen.data.push(...setThreeCategory);
1857
- // }
1858
- return pen;
1946
+ // 小图标便宜位置更新
1947
+ const iconNode = this.store.data.pens[dataPool.get(penData.cid).order];
1948
+ iconNode.rect.center.x = pen.rect.center.x + penData.dx;
1949
+ iconNode.rect.center.y = pen.rect.center.y + penData.dy;
1950
+ iconNode.rect.calcOffset();
1859
1951
  };
1860
1952
  Topology.prototype.newId = function (node, idMaps) {
1861
1953
  var old = node.id;
@@ -1868,13 +1960,15 @@ var Topology = (function (_super) {
1868
1960
  }
1869
1961
  }
1870
1962
  };
1871
- Topology.prototype.updateProps = function (cache, pens) {
1872
- if (cache === void 0) {
1873
- cache = true;
1874
- }
1875
- if (!pens) {
1876
- pens = this.activeLayer.pens;
1877
- }
1963
+ /**
1964
+ * 更新节点数据
1965
+ * @param motion 关联节点是否跟随移动
1966
+ * @param cache
1967
+ * @param pens
1968
+ */
1969
+ Topology.prototype.updateProps = function (motion = false, cache, pens) {
1970
+ if (cache === void 0) cache = true;
1971
+ if (!pens) pens = this.activeLayer.pens;
1878
1972
  let isAnimate = false;
1879
1973
  for (var _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
1880
1974
  var pen = pens_1[_i];
@@ -1893,6 +1987,7 @@ var Topology = (function (_super) {
1893
1987
  if (!pen.strokeStyle) {
1894
1988
  pen.strokeStyle = 'transparent'
1895
1989
  }
1990
+ if(motion === true || iconMotionData[motion]) this.resetBindWithIconConnectRect(pen); // 点位监控关联的小图标跟随移动
1896
1991
  }
1897
1992
  }
1898
1993
  this.activeLayer.updateLines(pens);
@@ -2042,43 +2137,43 @@ var Topology = (function (_super) {
2042
2137
  if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
2043
2138
  }
2044
2139
  },
2045
- Topology.prototype.addSelectTabOptionNode = function (node) {
2046
- const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
2047
- if(tagNode){
2048
- // 添加下拉节点关联的这个元件
2049
- const tagArr = tagNode.split('-');
2050
- const parentId = tagArr[1] && tagArr[1].trim();
2051
- if(!parentId) return;
2052
- const params = {
2053
- TID: node.TID,
2054
- id: node.id,
2055
- name: node.name,
2056
- order: node.order,
2057
- visible: node.visible,
2058
- tag: tagNode
2059
- }
2060
- this.store.selectTabDataPool[parentId].set(node.id, params);
2061
- }
2062
- },
2063
- Topology.prototype.find = function (idOrTag, pens) {
2064
- var _this = this;
2065
- if (!pens) {
2066
- pens = this.store.data.pens;
2067
- }
2068
- var result = [];
2069
- pens.forEach(function (item) {
2070
- if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
2071
- result.push(item);
2072
- }
2073
- if (item.children) {
2074
- result.push.apply(result, _this.find(idOrTag, item.children));
2140
+ Topology.prototype.addSelectTabOptionNode = function (node) {
2141
+ const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
2142
+ if(tagNode){
2143
+ // 添加下拉节点关联的这个元件
2144
+ const tagArr = tagNode.split('-');
2145
+ const parentId = tagArr[1] && tagArr[1].trim();
2146
+ if(!parentId) return;
2147
+ const params = {
2148
+ TID: node.TID,
2149
+ id: node.id,
2150
+ name: node.name,
2151
+ order: node.order,
2152
+ visible: node.visible,
2153
+ tag: tagNode
2154
+ }
2155
+ this.store.selectTabDataPool[parentId].set(node.id, params);
2156
+ }
2157
+ },
2158
+ Topology.prototype.find = function (idOrTag, pens) {
2159
+ var _this = this;
2160
+ if (!pens) {
2161
+ pens = this.store.data.pens;
2162
+ }
2163
+ var result = [];
2164
+ pens.forEach(function (item) {
2165
+ if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
2166
+ result.push(item);
2167
+ }
2168
+ if (item.children) {
2169
+ result.push.apply(result, _this.find(idOrTag, item.children));
2170
+ }
2171
+ });
2172
+ if (result.length === 1) {
2173
+ return result[0];
2075
2174
  }
2076
- });
2077
- if (result.length === 1) {
2078
- return result[0];
2079
- }
2080
- return result;
2081
- };
2175
+ return result;
2176
+ };
2082
2177
  Topology.prototype.findIndex = function (pen) {
2083
2178
  for (var i = 0; i < this.store.data.pens.length; ++i) {
2084
2179
  if (pen.id === this.store.data.pens[i].id) {
@@ -2096,7 +2191,7 @@ var Topology = (function (_super) {
2096
2191
  // < 1, reduce
2097
2192
  Topology.prototype.scale = function (scale, center, w, h) {
2098
2193
  if (this.store.data.scale * scale < this.store.options.minScale ||
2099
- this.store.data.scale * scale > this.store.options.maxScale) {
2194
+ this.store.data.scale * scale > this.store.options.maxScale) {
2100
2195
  return;
2101
2196
  }
2102
2197
  this.store.data.scale *= scale;
@@ -2190,8 +2285,8 @@ var Topology = (function (_super) {
2190
2285
  for (var _i = 0, pens_5 = pens; _i < pens_5.length; _i++) {
2191
2286
  var item = pens_5[_i];
2192
2287
  if (item.type === PenType.Node &&
2193
- rect.width === item.rect.width &&
2194
- rect.height === item.rect.height) {
2288
+ rect.width === item.rect.width &&
2289
+ rect.height === item.rect.height) {
2195
2290
  node = item;
2196
2291
  if (!node.children) {
2197
2292
  node.children = [];
@@ -2269,11 +2364,15 @@ var Topology = (function (_super) {
2269
2364
  let circles = graphData.circles;
2270
2365
  let points = graphData.points;
2271
2366
  let canvas = _this.canvas.canvas;
2272
- let context = canvas.getContext('2d');
2367
+ let context = canvas.getContext('2d', {
2368
+ alpha: false,
2369
+ desynchronized: true,
2370
+ willReadFrequently: false
2371
+ });
2273
2372
  for (var i = 0; i < circles.length; i++) {
2274
2373
  let circle = circles[i];
2275
2374
  var distanceFromCenter = Math.sqrt(Math.pow(circle.x - _this.mouseDown.x, 2)
2276
- + Math.pow(circle.y - _this.mouseDown.y, 2));
2375
+ + Math.pow(circle.y - _this.mouseDown.y, 2));
2277
2376
 
2278
2377
  if (distanceFromCenter <= circle.radius) {
2279
2378
 
@@ -2301,7 +2400,7 @@ var Topology = (function (_super) {
2301
2400
  if (points.length > 1) {
2302
2401
 
2303
2402
  var distanceFromStart = Math.sqrt(Math.pow(points[0].x - _this.mouseDown.x, 2)
2304
- + Math.pow(points[0].y - _this.mouseDown.y, 2));
2403
+ + Math.pow(points[0].y - _this.mouseDown.y, 2));
2305
2404
  }
2306
2405
 
2307
2406
  if (distanceFromStart <= 30) {
@@ -2386,37 +2485,10 @@ var Topology = (function (_super) {
2386
2485
  }
2387
2486
  }
2388
2487
 
2389
- if (window.location.pathname.includes('workspace') || (isClickTpye === true && !window.location.pathname.includes('workspace'))) {
2390
- return false
2391
- }
2488
+ return !(window.location.pathname.includes('workspace') || (isClickTpye === true && !window.location.pathname.includes('workspace')));
2489
+
2392
2490
 
2393
- return true
2394
2491
  };
2395
- Topology.prototype.formOverflowOpen = function (data) {
2396
- this.formOverflowConversionData(data);
2397
- this.overflowView();
2398
- this.render(true);
2399
- }
2400
- Topology.prototype.overflowView = function (data) {
2401
- try {
2402
- var rect = this.getRect();
2403
- let _a = this.canvas;
2404
- if(!_a.width) return;
2405
- let width = _a.width, height = _a.height;
2406
- let rectWidth = rect.width? (rect.ex + 4) : rect.width
2407
- let rectHeight= rect.height? (rect.ey + 4) : rect.height
2408
- if (width < rectWidth) {
2409
- width = rectWidth;
2410
- }
2411
- if (height < rectHeight) {
2412
- height = rectHeight;
2413
- }
2414
- this.resize({width: width, height: height});
2415
- return rect;
2416
- }catch (e){
2417
- console.log('-error--------overflowView---',e)
2418
- }
2419
- }
2420
2492
  return Topology;
2421
2493
  }(Common));
2422
2494