dcim-topology2d 2.2.3 → 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 (222) 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 +78 -86
  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 +18 -2
  27. package/core/src/activeLayer.d.ts +10 -2
  28. package/core/src/activeLayer.js +62 -57
  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 +68 -69
  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 -7
  36. package/core/src/common.js +698 -397
  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 -89
  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 -65
  47. package/core/src/middles/index.d.ts +2 -1
  48. package/core/src/middles/index.js +2 -4
  49. package/core/src/middles/nodes/arbitrarygraph.js +9 -11
  50. package/core/src/middles/nodes/pentagon.rect.js +1 -1
  51. package/core/src/middles/nodes/rectangle.js +15 -54
  52. package/core/src/middles/nodes/rectangle.rect.js +1 -1
  53. package/core/src/models/data.d.ts +26 -0
  54. package/core/src/models/data.js +77 -0
  55. package/core/src/models/data.js.map +1 -0
  56. package/core/src/models/index.d.ts +1 -0
  57. package/core/src/models/index.js +1 -0
  58. package/core/src/models/line.js +7 -7
  59. package/core/src/models/node.d.ts +0 -10
  60. package/core/src/models/node.js +101 -155
  61. package/core/src/models/pen.js +68 -37
  62. package/core/src/models/rect.js +2 -2
  63. package/core/src/mqtt.d.ts +14 -0
  64. package/core/src/mqtt.js +82 -0
  65. package/core/src/mqtt.js.map +1 -0
  66. package/core/src/offscreen.d.ts +4 -1
  67. package/core/src/offscreen.js +24 -26
  68. package/core/src/options.d.ts +1 -3
  69. package/core/src/options.js +0 -2
  70. package/core/src/poll.js +39 -0
  71. package/core/src/preview.d.ts +13 -2
  72. package/core/src/preview.js +54 -181
  73. package/core/src/renderLayer.d.ts +9 -11
  74. package/core/src/renderLayer.js +61 -60
  75. package/core/src/socket.d.ts +10 -0
  76. package/core/src/socket.js +51 -0
  77. package/core/src/socket.js.map +1 -0
  78. package/core/src/utils/canvas.js +1 -1
  79. package/core/src/utils/construction.d.ts +3 -36
  80. package/core/src/utils/construction.js +1 -29
  81. package/core/src/utils/conversion.d.ts +0 -15
  82. package/core/src/utils/conversion.js +0 -319
  83. package/core/src/utils/dom.d.ts +8 -0
  84. package/core/src/utils/dom.js +67 -0
  85. package/core/src/utils/dom.js.map +1 -0
  86. package/core/src/utils/index.d.ts +1 -2
  87. package/core/src/utils/index.js +1 -2
  88. package/core/src/utils/onmousevent.d.ts +0 -3
  89. package/core/src/utils/onmousevent.js +10 -42
  90. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  91. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  92. package/flow-diagram/src/comment/comment.d.ts +1 -1
  93. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  94. package/flow-diagram/src/data/data.anchor.js +1 -1
  95. package/flow-diagram/src/data/data.d.ts +1 -1
  96. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  97. package/flow-diagram/src/data/data.rect.js +1 -1
  98. package/flow-diagram/src/db/db.d.ts +1 -1
  99. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  100. package/flow-diagram/src/db/db.rect.js +1 -1
  101. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  102. package/flow-diagram/src/display/display.anchor.js +1 -1
  103. package/flow-diagram/src/display/display.d.ts +1 -1
  104. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  105. package/flow-diagram/src/display/display.rect.js +1 -1
  106. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  107. package/flow-diagram/src/document/document.anchor.js +1 -1
  108. package/flow-diagram/src/document/document.d.ts +1 -1
  109. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  110. package/flow-diagram/src/document/document.rect.js +1 -1
  111. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  112. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  113. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  114. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  115. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  116. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  117. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  118. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  119. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  120. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  121. package/flow-diagram/src/manually/manually.d.ts +1 -1
  122. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  123. package/flow-diagram/src/manually/manually.rect.js +1 -1
  124. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  125. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  126. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  127. package/flow-diagram/src/queue/queue.d.ts +1 -1
  128. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  129. package/flow-diagram/src/queue/queue.rect.js +1 -1
  130. package/flow-diagram/src/register.js +1 -1
  131. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  132. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  133. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  134. package/layout/src/align.d.ts +1 -1
  135. package/layout/src/align.js +1 -1
  136. package/layout/src/layout.d.ts +1 -1
  137. package/layout/src/layout.js +1 -1
  138. package/myShape-diagram/{index.js → myShape.js} +1 -4
  139. package/package.json +1 -1
  140. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  141. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  142. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  143. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  144. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  145. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  146. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  147. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  148. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  149. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  150. package/sequence-diagram/src/register.js +1 -1
  151. package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
  152. package/chart-diagram/src/utils/changeOptions.js +0 -273
  153. package/chart-diagram/src/utils/conversion.d.ts +0 -19
  154. package/chart-diagram/src/utils/conversion.js +0 -601
  155. package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
  156. package/chart-diagram/src/utils/drawGraphic.js +0 -97
  157. package/chart-diagram/src/utils/formatter.d.ts +0 -1
  158. package/chart-diagram/src/utils/formatter.js +0 -206
  159. package/chart-diagram/src/utils/index.d.ts +0 -5
  160. package/chart-diagram/src/utils/index.js +0 -5
  161. package/chart-diagram/src/utils/render.d.ts +0 -8
  162. package/chart-diagram/src/utils/render.js +0 -223
  163. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
  164. package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
  165. package/core/src/element/common.d.ts +0 -6
  166. package/core/src/element/common.js +0 -62
  167. package/core/src/element/datePicker.d.ts +0 -3
  168. package/core/src/element/datePicker.js +0 -44
  169. package/core/src/element/iframe.d.ts +0 -3
  170. package/core/src/element/iframe.js +0 -12
  171. package/core/src/element/index.d.ts +0 -5
  172. package/core/src/element/index.js +0 -6
  173. package/core/src/element/select.d.ts +0 -11
  174. package/core/src/element/select.js +0 -273
  175. package/core/src/element/tab.d.ts +0 -1
  176. package/core/src/element/tab.js +0 -20
  177. package/core/src/element/time.d.ts +0 -3
  178. package/core/src/element/time.js +0 -44
  179. package/core/src/middles/arrows/index.d.ts +0 -4
  180. package/core/src/middles/arrows/index.js +0 -5
  181. package/core/src/middles/lines/index.d.ts +0 -4
  182. package/core/src/middles/lines/index.js +0 -5
  183. package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
  184. package/core/src/middles/nodes/formDatePicker.js +0 -108
  185. package/core/src/middles/nodes/formoverflow.js +0 -62
  186. package/core/src/middles/nodes/formselect.d.ts +0 -2
  187. package/core/src/middles/nodes/formselect.js +0 -111
  188. package/core/src/middles/nodes/iframe.d.ts +0 -2
  189. package/core/src/middles/nodes/iframe.js +0 -29
  190. package/core/src/middles/nodes/index.d.ts +0 -52
  191. package/core/src/middles/nodes/index.js +0 -54
  192. package/core/src/middles/nodes/progress.d.ts +0 -2
  193. package/core/src/middles/nodes/progress.js +0 -63
  194. package/core/src/middles/nodes/progress.js.map +0 -1
  195. package/core/src/middles/nodes/switchs.d.ts +0 -2
  196. package/core/src/middles/nodes/switchs.js +0 -46
  197. package/core/src/middles/nodes/time.d.ts +0 -2
  198. package/core/src/middles/nodes/time.js +0 -98
  199. package/core/src/store/common.d.ts +0 -9
  200. package/core/src/store/common.js +0 -5
  201. package/core/src/store/data.d.ts +0 -205
  202. package/core/src/store/data.js +0 -198
  203. package/core/src/store/index.d.ts +0 -2
  204. package/core/src/store/index.js +0 -2
  205. package/core/src/utils/assignment.d.ts +0 -7
  206. package/core/src/utils/assignment.js +0 -229
  207. package/core/src/utils/params.d.ts +0 -3
  208. package/core/src/utils/params.js +0 -136
  209. package/static/echartsDefaultData.js +0 -178
  210. package/static/element.js +0 -14
  211. package/static/form.js +0 -11
  212. package/static/index.js +0 -3
  213. package/store/actions.js +0 -2
  214. package/store/clear.js +0 -14
  215. package/store/default.js +0 -22
  216. package/store/index.js +0 -3
  217. package/style/common.css +0 -15
  218. package/style/datePicker.css +0 -44
  219. package/style/editor.css +0 -16
  220. package/style/index.css +0 -5
  221. package/style/select.css +0 -143
  222. /package/myShape-diagram/{index.d.ts → myShape.ts} +0 -0
@@ -1,9 +1,8 @@
1
- import { Store } from "le5le-store";
2
1
  var __extends = (this && this.__extends) || (function () {
3
2
  var extendStatics = function (d, b) {
4
3
  extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- 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]; };
7
6
  return extendStatics(d, b);
8
7
  };
9
8
  return function (d, b) {
@@ -12,22 +11,10 @@ var __extends = (this && this.__extends) || (function () {
12
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
12
  };
14
13
  })();
15
- import { KeyType } from './options';
16
- import { Point } from './models';
14
+ import {KeyType} from './options';
15
+ import {Point} from './models';
17
16
  import { Common } from './common'
18
- import {
19
- downDataType,
20
- previewType,
21
- formatPadding,
22
- mousMoveFun,
23
- mousDownFun,
24
- omouseEventPrototDoWindowFn,
25
- pageZoom
26
- } from './utils';
27
- import {
28
- resetSelectInteractiveState,
29
- setSelectDropdownInteractiveState
30
- } from './element';
17
+ import {downDataType, formatPadding, mousMoveFun, mousDownFun, omouseEventPrototDoWindowFn} from './utils';
31
18
 
32
19
  var Preview = (function (_super) {
33
20
  __extends(Preview, _super);
@@ -35,33 +22,14 @@ var Preview = (function (_super) {
35
22
  var _this = _super.call(this, parent, options) || this;
36
23
  _this.offscreen.getRoutineLayer(['AnimateLayer']);
37
24
  _this.scheduledAnimationFrame = false;
38
- _this.innerHeight = window.innerHeight || document.documentElement.clientHeight; // 初始化网页高度
39
- _this.devicePixelInnerHeight = _this.innerHeight; // 初始化网页缩放高度
40
- _this.devicePixelRatio = window.devicePixelRatio; // 初始化窗口分辨率
41
- // 选中值发生变化时触发,目前用于日期切换
42
- _this.eventChangeSubcribe = Store.subscribe(this.generateStoreKey('EVENT:change'), function (data) {
43
- const { node, date } = data;
44
- const pickerBindData = _this.store.pickerDataPool.bindData;
45
- if (pickerBindData) {
46
- // 切换显示日期文字的元件值
47
- for (let value of Object.values(pickerBindData)) {
48
- if (value.dateId === node.id) {
49
- const pen = _this.store.data.pens[value.order];
50
- pen.text = date.valueStr;
51
- }
52
- }
53
- }
54
- node.formData.realIds ? _this.dispatch('change', node, date) : _this.render(); // eventOut外部事件
55
- });
56
25
  _this.onMouseMove = function (e) {
57
- _this.store.data.dataResize = 0;
58
26
  // https://caniuse.com/#feat=mdn-api_mouseevent_buttons
59
27
  if (_this.mouseDown && !_this.mouseDown.restore && e.buttons !== 1) {
60
28
  // 防止异常情况导致mouseup事件没有触发
61
29
  _this.onmouseup(e);
62
30
  return;
63
31
  }
64
- if (_this.store.data.locked && _this.mouseDown) {
32
+ if (_this.data.locked && _this.mouseDown) {
65
33
  return;
66
34
  }
67
35
  _this.scheduledAnimationFrame = true;
@@ -77,14 +45,14 @@ var Preview = (function (_super) {
77
45
  hoverNode,
78
46
  moveType,
79
47
  eventNode
80
- } = mousMoveFun(_this.store.options.type, pos, _this.store.data.pens);
48
+ } = mousMoveFun(_this.options.type, pos, _this.data.pens);
81
49
  _this.moveIn.type = _this.moveInType.None;
82
50
  _this.scheduledAnimationFrame = false;
83
51
  _this.hideTip();
84
- _this.setAttributeForCanvasPoint('default');
52
+ _this.divLayer.canvas.style.cursor = 'default';
85
53
  if (hoverNode) {
86
- if (eventNode) _this.setAttributeForCanvasPoint('pointer');
87
- if (hoverNode.visible) _this.showTip(hoverNode, pos);
54
+ if(eventNode) _this.divLayer.canvas.style.cursor = 'pointer';
55
+ if(hoverNode.visible) _this.showTip(hoverNode, pos);
88
56
  _this.moveIn.type = moveType;
89
57
  }
90
58
  _this.moveIn.eventNode = eventNode;
@@ -98,18 +66,16 @@ var Preview = (function (_super) {
98
66
  if (e.button !== 0)
99
67
  return;
100
68
  var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
101
- _this.mouseDown = { x: e.x - canvasPos.x, y: e.y - canvasPos.y };
69
+ _this.mouseDown = {x: e.x - canvasPos.x, y: e.y - canvasPos.y};
102
70
  if (e.altKey) {
103
- _this.setAttributeForCanvasPoint('pointer');
71
+ _this.divLayer.canvas.style.cursor = 'pointer';
104
72
  }
105
73
  if (_this.inputObj) {
106
74
  _this.setNodeText();
107
75
  }
108
- // 待优化,如何跳过这个函数,影响滚动组件功能
109
- resetSelectInteractiveState(_this.moveIn.hoverNode);
110
- const { eventType, value } = mousDownFun(_this.store.options.type, _this.moveIn.eventNode);
76
+ const {eventType, value} = mousDownFun(_this.options.type, _this.moveIn.eventNode);
111
77
  if (_this.moveIn.type == _this.moveInType.Nodes) {
112
- _this.setAttributeForCanvasPoint('pointer');
78
+ _this.divLayer.canvas.style.cursor = 'pointer';
113
79
  switch (eventType) {
114
80
  case downDataType.Window:
115
81
  omouseEventPrototDoWindowFn(_this.moveIn.eventNode, _this.moveIn.hoverNode);
@@ -118,20 +84,16 @@ var Preview = (function (_super) {
118
84
  _this.dispatch('node', _this.moveIn.hoverNode);
119
85
  break;
120
86
  case downDataType.Showhide:
121
- _this.hidePenByTag(_this.store.data.pens, value);
87
+ _this.hidePenByTag(_this.data.pens, value);
122
88
  const obj = value ? JSON.parse(value) : {}
123
89
  const visibleRange = obj.visibleRange
124
90
  if (visibleRange == '1') {
125
91
  _this.openCount++
126
92
  }
127
- _this.render();
128
93
  break;
129
94
  case downDataType.Tabswitch:
130
95
  _this.switchStaticsCheckType(_this.moveIn.hoverNode, _this.moveIn.eventNode);
131
96
  break;
132
- case downDataType.Formselect:
133
- setSelectDropdownInteractiveState(_this.moveIn.hoverNode, previewType.Dcim);
134
- break;
135
97
  }
136
98
  }
137
99
  };
@@ -141,20 +103,16 @@ var Preview = (function (_super) {
141
103
  _this.mouseDown = null;
142
104
  _this.lastTranlated.x = 0;
143
105
  _this.lastTranlated.y = 0;
144
- if (_this.moveIn.eventNode) {
145
- _this.setAttributeForCanvasPoint('pointer');
146
- } else {
147
- _this.setAttributeForCanvasPoint('default');
148
- }
106
+ _this.divLayer.canvas.style.cursor = _this.moveIn.eventNode ? 'pointer' : 'default';
149
107
  };
150
108
  _this.divLayer.canvas.onmousemove = this.onMouseMove;
151
109
  _this.divLayer.canvas.onmousedown = this.onmousedown;
152
110
  _this.divLayer.canvas.onmouseup = this.onmouseup;
153
111
  _this.divLayer.canvas.onwheel = function (event) {
154
- if (_this.store.options.disableScale || _this.store.options.type === 'dialog') {
112
+ if (_this.options.disableScale) {
155
113
  return;
156
114
  }
157
- switch (_this.store.options.scaleKey) {
115
+ switch (_this.options.scaleKey) {
158
116
  case KeyType.None:
159
117
  break;
160
118
  case KeyType.Ctrl:
@@ -180,16 +138,16 @@ var Preview = (function (_super) {
180
138
  event.preventDefault();
181
139
  if (event.deltaY < 0) {
182
140
  if (event.layerX && event.layerY) {
183
- _this.scale(1.1, { x: event.layerX, y: event.layerY });
184
- _this.canvas.scale(1.1, { x: event.layerX, y: event.layerY });
141
+ _this.scale(1.1, {x: event.layerX, y: event.layerY});
142
+ _this.canvas.scale(1.1, {x: event.layerX, y: event.layerY});
185
143
  } else {
186
144
  _this.scale(1.1);
187
145
  _this.canvas.scale(1.1);
188
146
  }
189
147
  } else {
190
148
  if (event.layerX && event.layerY) {
191
- _this.scale(0.9, { x: event.layerX, y: event.layerY });
192
- _this.canvas.scale(0.9, { x: event.layerX, y: event.layerY });
149
+ _this.scale(0.9, {x: event.layerX, y: event.layerY});
150
+ _this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
193
151
  } else {
194
152
  _this.scale(0.9);
195
153
  _this.canvas.scale(0.9);
@@ -199,118 +157,56 @@ var Preview = (function (_super) {
199
157
  _this.divLayer.canvas.focus();
200
158
  return false;
201
159
  };
202
- window.onresize = function () {
203
- let isFullScreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullscreenElement;
204
- if ((!isFullScreen && _this.isFullScreen) || window.keyControlFullScreen) {
205
- // F11或ESC退出全屏
206
- if (!window.keyControlFullScreen) _this.moveIn.hoverNode.text = '全屏';
207
- _this.fitViewPreview(_this.isFullScreen);
208
- _this.isFullScreen = false;
209
- window.keyControlFullScreen = false;
210
- } else {
211
- const documentElementHeight = window.innerHeight || document.documentElement.clientHeight; // 每次窗口有变化就重新获取一次网页高度
212
- if (window.devicePixelRatio !== _this.devicePixelRatio) {
213
- _this.devicePixelInnerHeight = documentElementHeight;
214
- _this.devicePixelRatio = window.devicePixelRatio;
215
- }
216
- if (_this.devicePixelInnerHeight < documentElementHeight && !isFullScreen) {
217
- // 按F11 全屏
218
- setTimeout(() => {
219
- _this.fitViewPreview(false);
220
- _this.isFullScreen = true;
221
- }, 200);
222
- window.keyControlFullScreen = true;
223
- }
224
- // topology编辑器或全屏下跳出程序
225
- if (_this.store.options.type === 'topology' || window.keyControlFullScreen) return;
226
- const zoom = pageZoom();
227
- _this.isResize = true;
228
- clearTimeout(_this.pageResizeTim);
229
- _this.pageResizeTim = setTimeout(() => {
230
- if (_this.isResize) {
231
- const pageZoom = 1 / zoom;
232
- _this.store.data.pageZoom = zoom;
233
- _this.store.parentElem.style.transform = `scale(${pageZoom})`;
234
- _this.store.parentElem.style.transformOrigin = '0 0';
235
- _this.store.parentElem.parentElement.style.overflow = 'hidden';
236
- _this.store.data.dataResize = 1;
237
- _this.isResize = false;
238
- Store.set('PAGE:zoom', zoom);
239
- _this.fitView();
240
- _this.render();
241
- }
242
- }, 1000);
243
- }
244
- };
245
- _this.subcribecreateOverflow = Store.subscribe(this.generateStoreKey('LT:createOverflow'), function (node) {
246
- _this.dispatch('createOverflow', node);
247
- });
248
- _this.subcribeconversionDataOverflow = Store.subscribe(this.generateStoreKey('LT:conversionDataOverflow'), function (data) {
249
- _this.dispatch('conversionDataOverflow', data);
250
- });
251
160
  return _this;
252
- }
253
- Preview.prototype.setAttributeForCanvasPoint = function (type) {
254
-
255
- this.divLayer.canvas.setAttribute('class', `canvas-point ${type}`);
256
-
257
161
  };
258
- Preview.prototype.fitViewPreview = function (restore) {
162
+ Preview.prototype.fitViewPreview = function (restore){
259
163
  this.fitView(null, restore);
260
164
  this.render();
261
165
  };
262
166
  // open - redraw by the data
263
- Preview.prototype.open = function (topoJSon, type) {
167
+ Preview.prototype.open = function (topoJSon) {
264
168
  this.conversionData(topoJSon);
265
- this.setBKImageRect();
169
+ this.parentElem.scrollLeft = 0;
170
+ this.parentElem.scrollTop = 0;
171
+ this.divLayer.clear();
266
172
  this.fitView();
267
173
  this.render(true);
268
174
  this.animate(true);
269
175
  };
270
- Preview.prototype.setBKImageRect = function () {
271
- if (this.store.data.bkImageRect) {
272
- this.store.data.bkImageRect.x = this.store.data.bkImageRect.x ? Number(this.store.data.bkImageRect.x) : 0;
273
- this.store.data.bkImageRect.y = this.store.data.bkImageRect.y ? Number(this.store.data.bkImageRect.y) : 0;
274
- this.store.data.bkImageRect.width = this.store.data.bkImageRect.width ? Number(this.store.data.bkImageRect.width) : this.canvas.width;
275
- this.store.data.bkImageRect.height = this.store.data.bkImageRect.height ? Number(this.store.data.bkImageRect.height) : this.canvas.height;
276
- this.store.data.bkImageRect.center = {
277
- x: this.store.data.bkImageRect.x + this.store.data.bkImageRect.width / 2,
278
- y: this.store.data.bkImageRect.y + this.store.data.bkImageRect.height / 2
279
- }
280
- }
281
- };
282
176
  Preview.prototype.scale = function (scale, center, w, h) {
283
- if (this.store.data.scale * scale < this.store.options.minScale ||
284
- this.store.data.scale * scale > this.store.options.maxScale) {
177
+ if (this.data.scale * scale < this.options.minScale ||
178
+ this.data.scale * scale > this.options.maxScale) {
285
179
  return;
286
180
  }
287
- this.store.data.scale *= scale;
181
+ const scaleX = w ? w : scale;
182
+ const scaleY = h ? h : scale;
183
+ this.data.scale *= scale;
184
+ if(this.isFullScreen) {
185
+ this.ratioCord.ratio *= scale;
186
+ this.ratioCord.scaleX *= scaleX;
187
+ this.ratioCord.scaleY *= scaleY;
188
+ }else {
189
+ this.ratioCord.ratio = 1;
190
+ this.ratioCord.scaleX = 1;
191
+ this.ratioCord.scaleY = 1;
192
+ }
288
193
  !center && (center = this.getRect().center);
289
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
194
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
290
195
  var item = _a[_i];
291
196
  item.scale(scale, center, w, h);
292
- // 驾驶舱底部区域元件,用于控制底部区域Dom宽高等元素自由变换,后期会删除
293
- if (item.tags && item.tags[0] && item.tags[0].includes('contromRoomBottom')) this.store.pens['contromRoomBottom'] = item;
294
197
  }
295
198
  };
296
199
  Preview.prototype.scaleTo = function (scale) {
297
- this.scale(scale / this.store.data.scale);
298
- this.store.data.scale = scale;
200
+ this.scale(scale / this.data.scale);
201
+ this.data.scale = scale;
299
202
  };
300
203
  // scale for origin canvas:
301
204
  Preview.prototype.fitView = function (viewPadding, restore) {
302
205
  if (!this.hasView())
303
206
  return;
304
207
  // 1. 重置画布尺寸为容器尺寸
305
- var parentElem = this.store.parentElem;
306
- var width = parentElem.offsetWidth,
307
- height = parentElem.offsetHeight;
308
- if (this.store.options.storeSubscribe) {
309
- width = this.store.options.width;
310
- height = this.store.options.height;
311
- }
312
- width *= this.store.data.pageZoom;
313
- height *= this.store.data.pageZoom;
208
+ var parentElem = this.canvas.parentElem;
209
+ var width = parentElem.offsetWidth, height = parentElem.offsetHeight;
314
210
  this.canvasResize({
315
211
  width: width,
316
212
  height: height,
@@ -318,14 +214,9 @@ var Preview = (function (_super) {
318
214
  // 2. 图形居中
319
215
  this.centerView(viewPadding);
320
216
  // 3. 获取设置的留白值
321
- var padding = formatPadding(viewPadding || this.store.options.viewPadding);
217
+ var padding = formatPadding(viewPadding || this.options.viewPadding);
322
218
  // 4. 获取图形尺寸
323
219
  var rect = this.getRect();
324
- if (!rect.width) {
325
- const bkImageRect = this.store.data.bkImageRect;
326
- rect.width = bkImageRect && bkImageRect.width ? bkImageRect.width : width;
327
- rect.height = bkImageRect && bkImageRect.height ? bkImageRect.height : height;
328
- }
329
220
  // 6. 计算缩放比
330
221
  var w = (width - padding[1] - padding[3]) / rect.width;
331
222
  var h = (height - padding[0] - padding[2]) / rect.height;
@@ -333,42 +224,24 @@ var Preview = (function (_super) {
333
224
  if (w > h) {
334
225
  ratio = h;
335
226
  }
336
- // 保持缩放后的还原度
337
- if (typeof restore === 'boolean' && restore) ratio = w;
227
+ if(typeof restore === 'boolean' && restore) {
228
+ ratio = 1 / this.ratioCord.ratio;
229
+ w = 1 / this.ratioCord.scaleX;
230
+ h = 1 / this.ratioCord.scaleY;
231
+ }
338
232
  this.scale(ratio, undefined, w, h);
339
233
  this.canvas.scale(ratio, undefined, w, h);
340
234
  // 7. X抽滚动条隐藏
341
- this.store.parentElem.style.overflow = 'hidden auto';
235
+ this.parentElem.style.overflow = 'hidden auto';
342
236
  };
343
- Preview.prototype.formOverflowOpen = function (data) {
344
- this.formOverflowConversionData(data);
345
- this.overflowView();
346
- this.render(true);
347
- }
348
- Preview.prototype.overflowView = function () {
349
- if (!this.hasView())
350
- return;
351
- var rect = this.getRect();
352
- var width = rect.ex,
353
- height = rect.ey
354
- width *= this.store.data.pageZoom;
355
- height *= this.store.data.pageZoom;
356
- this.canvasResize({
357
- width: width,
358
- height: height,
359
- });
360
- this.store.parentElem.style.overflow = 'auto';
361
- }
362
237
  Preview.prototype.destroy = function () {
363
238
  this.destroyStatic();
364
- if (this.eventChangeSubcribe) this.eventChangeSubcribe.unsubscribe();
365
239
  this.onMouseMove = null;
366
240
  this.onmousedown = null;
367
241
  this.onmouseup = null;
368
- window.onresize = null;
369
242
  };
370
243
  return Preview;
371
244
  }(Common));
372
245
 
373
- export { Preview };
246
+ export {Preview};
374
247
  //# sourceMappingURL=core.js.map
@@ -2,29 +2,27 @@ import { Options } from './options';
2
2
  import { Canvas } from './canvas';
3
3
  import {Point} from './models';
4
4
  export declare class RenderLayer extends Canvas {
5
+ parentElem: HTMLElement;
6
+ options: Options;
5
7
  offscreen: any;
6
8
  bkImg: HTMLImageElement;
7
9
  bkImgRect: {
8
- center: {
9
- x: number;
10
- y: number;
11
- },
12
10
  x: number;
13
11
  y: number;
14
12
  width: number;
15
13
  height: number;
16
14
  };
17
15
  bgRect: {
18
- // center: {
19
- // x: number;
20
- // y: number;
21
- // },
16
+ center: {
17
+ x: number;
18
+ y: number;
19
+ },
22
20
  x: number;
23
21
  y: number;
24
- // width: number;
25
- // height: number;
22
+ width: number;
23
+ height: number;
26
24
  };
27
- constructor(TID: String);
25
+ constructor(parentElem: HTMLElement, options: Options, TID: String);
28
26
  loadBkImg(cb?: any): void;
29
27
  clearBkImg(): void;
30
28
  render: () => void;
@@ -13,23 +13,22 @@ var __extends = (this && this.__extends) || (function () {
13
13
  })();
14
14
  import { Store } from 'le5le-store';
15
15
  import { Canvas } from './canvas';
16
- import { commonStore } from './store'
16
+ import {previewType} from './utils/construction'
17
17
  //let isQttFillStyle = false;
18
18
  var RenderLayer = /** @class */ (function (_super) {
19
19
  __extends(RenderLayer, _super);
20
- function RenderLayer(TID) {
20
+ function RenderLayer(parentElem, options, TID) {
21
21
  //isQttFillStyle = false;
22
- var _this = _super.call(this, TID) || this;
22
+ if (options === void 0) { options = {}; }
23
+ var _this = _super.call(this, parentElem, options, TID) || this;
24
+ _this.parentElem = parentElem;
25
+ _this.options = options;
23
26
  _this.bkImgRect = null;
24
27
  _this.initImage = false;
25
28
  _this.coverType = 'container';
26
29
  _this.bgRect = null;
27
- _this.scaleX = 1;
28
- _this.scaleY = 1;
29
- _this.ratio = 1;
30
30
  _this.render = function () {
31
- if(!commonStore || !commonStore[TID]) return;
32
- if (commonStore[TID].data.bkImage && !_this.initImage) {
31
+ if (_this.data.bkImage && !_this.initImage) {
33
32
  _this.loadBkImg(_this.render, 'pixi');
34
33
  return;
35
34
  }
@@ -38,8 +37,12 @@ var RenderLayer = /** @class */ (function (_super) {
38
37
  }
39
38
  var ctx = _this.canvas.getContext('2d');
40
39
  ctx.clearRect(0, 0, _this.canvas.width, _this.canvas.height);
41
- if (commonStore[TID].data.bkColor) {
42
- ctx.fillStyle = commonStore[TID].data.bkColor;
40
+ // if (_this.data.pens && _this.data.pens.length > 0 && !isQttFillStyle) {
41
+ // _this.data.pens.map((penItem) => {penItem.defaultFillStyle = penItem.fillStyle;})
42
+ // isQttFillStyle = true;
43
+ // }
44
+ if (_this.data.bkColor) {
45
+ ctx.fillStyle = _this.data.bkColor;
43
46
  ctx.fillRect(0, 0, _this.width, _this.height);
44
47
  }
45
48
  if (_this.bkImg && _this.bkImgRect) {
@@ -49,52 +52,53 @@ var RenderLayer = /** @class */ (function (_super) {
49
52
  ctx.drawImage(_this.offscreen, 0, 0, _this.width, _this.height);
50
53
  };
51
54
  _this.offscreen = Store.get(_this.generateStoreKey('LT:offscreen'));
52
- commonStore[TID].parentElem.appendChild(_this.canvas);
55
+ _this.parentElem.appendChild(_this.canvas);
53
56
  return _this;
54
57
  }
55
58
  RenderLayer.prototype.scale = function (scale, center, w, h){
56
- if(!this.bkImgRect) {
57
- this.scaleX = w ? w : scale;
58
- this.scaleY = h ? h : scale;
59
- this.ratio = scale;
60
- return;
61
- }
59
+ if(!this.data.bkImage) return;
62
60
  if(!center) {
63
- center = this.bkImgRect.center;
61
+ center = this.data.bkImageRect ? this.data.bkImageRect.center : this.bgRect.center;
64
62
  }
65
63
  if (!w) {
66
64
  w = scale;
67
- this.bkImgRect.x = center.x - (center.x - this.bkImgRect.x) * scale;
68
- }else {
69
- this.bkImgRect.x = this.bgRect.x;
65
+ if(this.data.bkImageRect) {
66
+ this.data.bkImageRect.x = center.x - (center.x - this.data.bkImageRect.x) * w;
67
+ }else {
68
+ this.bgRect.x = center.x - (center.x - this.bgRect.x) * w;
69
+ }
70
70
  }
71
71
  if (!h) {
72
72
  h = scale;
73
- this.bkImgRect.y = center.y - (center.y - this.bkImgRect.y) * scale;
73
+ if(this.data.bkImageRect){
74
+ this.data.bkImageRect.y = center.y - (center.y - this.data.bkImageRect.y) * h;
75
+ }else {
76
+ this.bgRect.y = center.y - (center.y - this.bgRect.y) * h;
77
+ }
78
+ }
79
+ if(this.data.bkImageRect) {
80
+ this.data.bkImageRect.width *= w;
81
+ this.data.bkImageRect.height *= h;
82
+ this.bkImgRect = this.data.bkImageRect;
74
83
  }else {
75
- this.bkImgRect.y = this.bgRect.y;
84
+ if(this.initImage) {
85
+ this.bgRect.width *= w;
86
+ this.bgRect.height *= h;
87
+ }
88
+ this.bkImgRect = this.bgRect;
76
89
  }
77
- this.bkImgRect.width *= w;
78
- this.bkImgRect.height *= h;
79
- this.calcCenter();
80
- };
81
- RenderLayer.prototype.calcCenter = function () {
82
- this.bkImgRect.center.x = this.bkImgRect.x + this.bkImgRect.width / 2;
83
- this.bkImgRect.center.y = this.bkImgRect.y + this.bkImgRect.height / 2;
84
90
  };
85
91
  RenderLayer.prototype.loadBkImg = function (cb, pixi) {
86
92
  var _this = this;
87
- const bkImage = commonStore[_this.TID].data.bkImage;
88
- if (!bkImage || this.initImage) {
93
+ if (!this.data.bkImage || this.initImage) {
89
94
  return;
90
95
  }
91
96
  this.bkImg = new Image();
92
97
  this.bkImg.crossOrigin = 'anonymous';
93
- this.bkImg.src = bkImage;
98
+ this.bkImg.src = this.data.bkImage;
94
99
  this.bkImg.onload = function () {
95
100
  if(pixi && !_this.bkImgRect) {
96
- _this.bkImgRectResize({width: _this.width, height: _this.height});
97
- _this.scale(_this.ratio, undefined, _this.scaleX, _this.scaleY);
101
+ _this.bkImgRectResize({width: _this.canvas.width, height: _this.canvas.height});
98
102
  }else {
99
103
  //_this.bkImgRect = _this.coverRect(_this.canvas.width, _this.canvas.height, _this.bkImg.width, _this.bkImg.height);
100
104
  }
@@ -102,6 +106,10 @@ var RenderLayer = /** @class */ (function (_super) {
102
106
  cb();
103
107
  }
104
108
  _this.initImage = true;
109
+ _this.bgRect.center.x = _this.width / 2;
110
+ _this.bgRect.center.y = _this.height / 2;
111
+ _this.bgRect.width = _this.width;
112
+ _this.bgRect.height = _this.height;
105
113
  };
106
114
  };
107
115
  RenderLayer.prototype.clearBkImg = function () {
@@ -109,8 +117,14 @@ var RenderLayer = /** @class */ (function (_super) {
109
117
  this.bkImg = null;
110
118
  this.initImage = false;
111
119
  this.bgRect = {
120
+ center: {
121
+ x: this.width / 2,
122
+ y: this.height / 2
123
+ },
112
124
  x: 0,
113
- y: 0
125
+ y: 0,
126
+ width: this.width,
127
+ height: this.height
114
128
  }
115
129
  };
116
130
  RenderLayer.prototype.coverRect = function (canvasWidth, canvasHeight, imgWidth, imgHeight) {
@@ -135,50 +149,37 @@ var RenderLayer = /** @class */ (function (_super) {
135
149
  };
136
150
 
137
151
  RenderLayer.prototype.bkImgRectResize = function (size) {
138
- const bkImageRect = commonStore[this.TID].data.bkImageRect;
152
+ const bkImageRect = this.data.bkImageRect;
139
153
  if(!size) return;
140
- const { width, height } = size;
141
154
  if(bkImageRect) {
142
155
  let x = bkImageRect.x ? Number(bkImageRect.x) : 0;
143
156
  let y = bkImageRect.y ? Number(bkImageRect.y) : 0;
157
+ const { width, height } = size;
144
158
  let bkWidth = bkImageRect.width ? Number(bkImageRect.width) : width;
145
159
  let bkHeight = bkImageRect.height ? Number(bkImageRect.height) : height;
146
160
  this.bkImgRect = {
147
- center: {
148
- x: x + bkWidth / 2,
149
- y: y + bkHeight / 2
150
- },
151
- x,
152
- y,
153
- width: bkWidth,
154
- height: bkHeight
155
- };
156
- this.bgRect = {
157
- x,
158
- y
161
+ x: x,
162
+ y: y,
163
+ width: bkImageRect.width ? bkImageRect.width : width,
164
+ height: bkImageRect.height ? bkImageRect.height : height
159
165
  };
160
166
  }else {
161
- this.bkImgRect = {
162
- center: {
163
- x: width / 2,
164
- y: height / 2
165
- },
166
- x: 0,
167
- y: 0,
168
- width,
169
- height
170
- };
167
+ this.bkImgRect = this.bgRect;
171
168
  }
172
169
  };
173
170
 
174
171
  RenderLayer.prototype.destroy = function() {
175
172
 
173
+ this.data = null;
174
+
176
175
  this.canvas = null;
177
176
 
178
177
  this.render = null;
179
178
 
180
179
  this.offscreen = null;
181
180
 
181
+ this.options = null;
182
+
182
183
  }
183
184
  return RenderLayer;
184
185
  }(Canvas));
@@ -0,0 +1,10 @@
1
+ import { TopologyData } from './models';
2
+ export declare class Socket {
3
+ url: string;
4
+ data: TopologyData;
5
+ socket: WebSocket;
6
+ constructor(url: string, data: TopologyData);
7
+ init(): void;
8
+ onmessage: (e: MessageEvent) => void;
9
+ close(): void;
10
+ }