dcim-topology2d 2.1.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/activity-diagram/src/final/final.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.js +1 -1
- package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
- package/activity-diagram/src/fork/fork.anchor.js +1 -1
- package/activity-diagram/src/fork/fork.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.js +1 -1
- package/activity-diagram/src/register.js +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
- package/chart-diagram/index.d.ts +1 -3
- package/chart-diagram/index.js +1 -2
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +104 -109
- package/chart-diagram/src/register.js +8 -9
- package/class-diagram/src/class/class.d.ts +1 -1
- package/class-diagram/src/class/class.rect.d.ts +1 -1
- package/class-diagram/src/class/class.rect.js +1 -1
- package/class-diagram/src/register.js +1 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -2
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +47 -42
- package/core/src/animateLayer.d.ts +7 -3
- package/core/src/animateLayer.js +12 -10
- package/core/src/calling.d.ts +4 -1
- package/core/src/calling.js +41 -43
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +21 -22
- package/core/src/common.d.ts +7 -6
- package/core/src/common.js +674 -341
- package/core/src/core.d.ts +4 -5
- package/core/src/core.js +385 -522
- package/core/src/divLayer.d.ts +36 -2
- package/core/src/divLayer.js +305 -33
- package/core/src/healps/changeData.d.ts +2 -1
- package/core/src/healps/changeData.js +66 -32
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- package/core/src/middles/default.d.ts +3 -1
- package/core/src/middles/default.js +51 -59
- package/core/src/middles/index.js +2 -3
- package/core/src/middles/nodes/arbitrarygraph.js +9 -11
- package/core/src/middles/nodes/pentagon.rect.js +1 -1
- package/core/src/middles/nodes/rectangle.rect.js +1 -1
- package/core/src/models/data.d.ts +26 -0
- package/core/src/models/data.js +77 -0
- package/core/src/models/data.js.map +1 -0
- package/core/src/models/index.d.ts +1 -0
- package/core/src/models/index.js +1 -0
- package/core/src/models/node.d.ts +0 -10
- package/core/src/models/node.js +36 -81
- package/core/src/models/pen.js +59 -19
- package/core/src/models/rect.js +2 -2
- package/core/src/mqtt.d.ts +14 -0
- package/core/src/mqtt.js +82 -0
- package/core/src/mqtt.js.map +1 -0
- package/core/src/offscreen.d.ts +4 -1
- package/core/src/offscreen.js +8 -10
- package/core/src/options.d.ts +1 -3
- package/core/src/options.js +0 -2
- package/core/src/poll.js +39 -0
- package/core/src/preview.d.ts +13 -2
- package/core/src/preview.js +43 -135
- package/core/src/renderLayer.d.ts +9 -11
- package/core/src/renderLayer.js +61 -60
- package/core/src/socket.d.ts +10 -0
- package/core/src/socket.js +51 -0
- package/core/src/socket.js.map +1 -0
- package/core/src/utils/canvas.js +1 -1
- package/core/src/utils/construction.d.ts +3 -12
- package/core/src/utils/construction.js +1 -8
- package/core/src/utils/conversion.d.ts +0 -13
- package/core/src/utils/conversion.js +0 -210
- package/core/src/utils/dom.d.ts +8 -0
- package/core/src/utils/dom.js +67 -0
- package/core/src/utils/dom.js.map +1 -0
- package/core/src/utils/index.d.ts +1 -2
- package/core/src/utils/index.js +1 -2
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.d.ts +0 -3
- package/core/src/utils/onmousevent.js +10 -42
- package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
- package/flow-diagram/src/comment/comment.anchor.js +1 -1
- package/flow-diagram/src/comment/comment.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.js +1 -1
- package/flow-diagram/src/data/data.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.js +1 -1
- package/flow-diagram/src/db/db.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.js +1 -1
- package/flow-diagram/src/display/display.anchor.d.ts +1 -1
- package/flow-diagram/src/display/display.anchor.js +1 -1
- package/flow-diagram/src/display/display.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.js +1 -1
- package/flow-diagram/src/document/document.anchor.d.ts +1 -1
- package/flow-diagram/src/document/document.anchor.js +1 -1
- package/flow-diagram/src/document/document.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
- package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
- package/flow-diagram/src/manually/manually.anchor.js +1 -1
- package/flow-diagram/src/manually/manually.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.js +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
- package/flow-diagram/src/parallel/parallel.d.ts +1 -1
- package/flow-diagram/src/queue/queue.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.js +1 -1
- package/flow-diagram/src/register.js +1 -1
- package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
- package/layout/src/align.d.ts +1 -1
- package/layout/src/align.js +1 -1
- package/layout/src/layout.d.ts +1 -1
- package/layout/src/layout.js +1 -1
- package/myShape-diagram/{index.js → myShape.js} +1 -4
- package/package.json +1 -1
- package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.anchor.js +1 -1
- package/sequence-diagram/src/focus/focus.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
- package/sequence-diagram/src/register.js +1 -1
- package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
- package/chart-diagram/src/utils/changeOptions.js +0 -267
- package/chart-diagram/src/utils/conversion.d.ts +0 -19
- package/chart-diagram/src/utils/conversion.js +0 -559
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/formatter.d.ts +0 -1
- package/chart-diagram/src/utils/formatter.js +0 -206
- package/chart-diagram/src/utils/index.d.ts +0 -5
- package/chart-diagram/src/utils/index.js +0 -5
- package/chart-diagram/src/utils/render.d.ts +0 -8
- package/chart-diagram/src/utils/render.js +0 -219
- package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
- package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
- package/core/src/element/common.d.ts +0 -6
- package/core/src/element/common.js +0 -54
- package/core/src/element/datePicker.d.ts +0 -3
- package/core/src/element/datePicker.js +0 -47
- package/core/src/element/iframe.d.ts +0 -3
- package/core/src/element/iframe.js +0 -12
- package/core/src/element/index.d.ts +0 -5
- package/core/src/element/index.js +0 -6
- package/core/src/element/select.d.ts +0 -11
- package/core/src/element/select.js +0 -275
- package/core/src/element/tab.d.ts +0 -1
- package/core/src/element/tab.js +0 -25
- package/core/src/element/time.d.ts +0 -3
- package/core/src/element/time.js +0 -44
- package/core/src/middles/arrows/index.d.ts +0 -4
- package/core/src/middles/arrows/index.js +0 -5
- package/core/src/middles/lines/index.d.ts +0 -4
- package/core/src/middles/lines/index.js +0 -5
- package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
- package/core/src/middles/nodes/formDatePicker.js +0 -66
- package/core/src/middles/nodes/formoverflow.js +0 -61
- package/core/src/middles/nodes/formselect.d.ts +0 -2
- package/core/src/middles/nodes/formselect.js +0 -102
- package/core/src/middles/nodes/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -29
- package/core/src/middles/nodes/index.d.ts +0 -50
- package/core/src/middles/nodes/index.js +0 -52
- package/core/src/middles/nodes/time.d.ts +0 -2
- package/core/src/middles/nodes/time.js +0 -98
- package/core/src/store/common.d.ts +0 -9
- package/core/src/store/common.js +0 -5
- package/core/src/store/data.d.ts +0 -194
- package/core/src/store/data.js +0 -187
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/core/src/utils/assignment.d.ts +0 -7
- package/core/src/utils/assignment.js +0 -185
- package/core/src/utils/params.d.ts +0 -2
- package/core/src/utils/params.js +0 -65
- package/static/echartsDefaultData.js +0 -178
- package/static/element.js +0 -14
- package/static/form.js +0 -11
- package/static/index.js +0 -3
- package/store/actions.js +0 -1
- package/store/clear.js +0 -10
- package/store/index.js +0 -2
- package/style/common.css +0 -15
- package/style/datePicker.css +0 -44
- package/style/editor.css +0 -16
- package/style/index.css +0 -5
- package/style/select.css +0 -143
- /package/myShape-diagram/{index.ts → myShape.ts} +0 -0
package/core/src/core.js
CHANGED
@@ -16,25 +16,10 @@ import { Common } from './common'
|
|
16
16
|
import {HoverLayer} from './hoverLayer';
|
17
17
|
import {ActiveLayer} from './activeLayer';
|
18
18
|
import {KeyType, KeydownType} from './options';
|
19
|
-
import {PenType, Node, Point, Line, Lock, AnchorMode, Rect} from './models';
|
19
|
+
import {PenType, Node, Point, Line, TopologyData, Lock, AnchorMode, Rect} from './models';
|
20
20
|
import {drawNodeFns, drawLineFns} from './middles/index';
|
21
|
-
import {
|
22
|
-
|
23
|
-
pointInRect,
|
24
|
-
formatPadding,
|
25
|
-
setTagIdData,
|
26
|
-
setKpiAddrData,
|
27
|
-
setAssetIdData,
|
28
|
-
setAreaIdData,
|
29
|
-
setVarValueData,
|
30
|
-
setBranchAddressData,
|
31
|
-
setThreeCategoryIdData,
|
32
|
-
setConnectionTagForConf,
|
33
|
-
setConnectionTabsData,
|
34
|
-
getTabConnectSHConf
|
35
|
-
} from './utils';
|
36
|
-
import {setSelectElementPosition} from './element';
|
37
|
-
import {elementType} from '../../static';
|
21
|
+
import { s8, pointInRect, formatPadding, previewType} from './utils';
|
22
|
+
import axios from 'axios'
|
38
23
|
|
39
24
|
var resizeCursors = ['nw-resize', 'ne-resize', 'se-resize', 'sw-resize'];
|
40
25
|
var dockOffset = 10;
|
@@ -42,8 +27,8 @@ var Topology = (function (_super) {
|
|
42
27
|
__extends(Topology, _super);
|
43
28
|
function Topology(parent, options) {
|
44
29
|
var _this = _super.call(this, parent, options) || this;
|
45
|
-
_this.hoverLayer = new HoverLayer(_this.id);
|
46
|
-
_this.activeLayer = new ActiveLayer(_this.id);
|
30
|
+
_this.hoverLayer = new HoverLayer(this.options, _this.id);
|
31
|
+
_this.activeLayer = new ActiveLayer(this.options, _this.id);
|
47
32
|
_this.offscreen.getRoutineLayer();
|
48
33
|
_this.activeLayer.topology = this;
|
49
34
|
_this.gridElem = document.createElement('div');
|
@@ -51,10 +36,8 @@ var Topology = (function (_super) {
|
|
51
36
|
index: 0,
|
52
37
|
list: [],
|
53
38
|
};
|
54
|
-
_this.isTabHideShow = false;
|
55
39
|
_this.needCache = false;
|
56
40
|
_this.addingArbitraryGraph = false;
|
57
|
-
_this.nodeId = '';
|
58
41
|
_this.arbitrarygGraphData = {
|
59
42
|
points: [],
|
60
43
|
circles: [],
|
@@ -67,7 +50,7 @@ var Topology = (function (_super) {
|
|
67
50
|
if (Store.get('addingArbitraryGraph')) {
|
68
51
|
return
|
69
52
|
}
|
70
|
-
if (_this.scheduledAnimationFrame || _this.
|
53
|
+
if (_this.scheduledAnimationFrame || _this.data.locked === Lock.NoEvent) {
|
71
54
|
return;
|
72
55
|
}
|
73
56
|
// https://caniuse.com/#feat=mdn-api_mouseevent_buttons
|
@@ -78,7 +61,7 @@ var Topology = (function (_super) {
|
|
78
61
|
}
|
79
62
|
if (_this.mouseDown) {
|
80
63
|
var b = false;
|
81
|
-
switch (_this.
|
64
|
+
switch (_this.options.translateKey) {
|
82
65
|
case KeyType.None:
|
83
66
|
b = true;
|
84
67
|
break;
|
@@ -112,9 +95,8 @@ var Topology = (function (_super) {
|
|
112
95
|
_this.dispatch('translate', {x, y});
|
113
96
|
return false;
|
114
97
|
}
|
115
|
-
|
116
98
|
}
|
117
|
-
if (_this.
|
99
|
+
if (_this.data.locked && _this.mouseDown) {
|
118
100
|
return;
|
119
101
|
}
|
120
102
|
_this.scheduledAnimationFrame = true;
|
@@ -168,18 +150,18 @@ var Topology = (function (_super) {
|
|
168
150
|
return;
|
169
151
|
}
|
170
152
|
// Move out parent element.
|
171
|
-
var moveOutX = pos.x + 50 > _this.
|
172
|
-
var moveOutY = pos.y + 50 > _this.
|
173
|
-
if (!_this.
|
153
|
+
var moveOutX = pos.x + 50 > _this.parentElem.clientWidth + _this.parentElem.scrollLeft;
|
154
|
+
var moveOutY = pos.y + 50 > _this.parentElem.clientHeight + _this.parentElem.scrollTop;
|
155
|
+
if (!_this.options.disableMoveOutParent && (moveOutX || moveOutY)) {
|
174
156
|
_this.dispatch('moveOutParent', pos);
|
175
|
-
if (_this.
|
157
|
+
if (_this.options.autoExpandDistance > 0) {
|
176
158
|
var resize = false;
|
177
159
|
if (pos.x + 50 > _this.divLayer.canvas.clientWidth) {
|
178
|
-
_this.canvas.width += _this.
|
160
|
+
_this.canvas.width += _this.options.autoExpandDistance;
|
179
161
|
resize = true;
|
180
162
|
}
|
181
163
|
if (pos.y + 50 > _this.divLayer.canvas.clientHeight) {
|
182
|
-
_this.canvas.height += _this.
|
164
|
+
_this.canvas.height += _this.options.autoExpandDistance;
|
183
165
|
resize = true;
|
184
166
|
}
|
185
167
|
if (resize) {
|
@@ -188,21 +170,20 @@ var Topology = (function (_super) {
|
|
188
170
|
height: _this.canvas.height,
|
189
171
|
});
|
190
172
|
}
|
191
|
-
_this.scroll(moveOutX ? _this.
|
173
|
+
_this.scroll(moveOutX ? _this.options.autoExpandDistance / 2 : 0, moveOutY ? _this.options.autoExpandDistance / 2 : 0);
|
192
174
|
}
|
193
175
|
}
|
194
|
-
var moveLeft = pos.x - 100 < _this.
|
195
|
-
var moveTop = pos.y - 100 < _this.
|
176
|
+
var moveLeft = pos.x - 100 < _this.parentElem.scrollLeft;
|
177
|
+
var moveTop = pos.y - 100 < _this.parentElem.scrollTop;
|
196
178
|
if ((moveLeft || moveTop)) {
|
197
179
|
_this.scroll(moveLeft ? -100 : 0, moveTop ? -100 : 0);
|
198
180
|
}
|
199
|
-
//console.log('_this.moveIn.type----', _this.moveIn.type)
|
181
|
+
// console.log('_this.moveIn.type----', _this.moveIn.type)
|
200
182
|
switch (_this.moveIn.type) {
|
201
183
|
case _this.moveInType.None:
|
202
184
|
_this.hoverLayer.dragRect = new Rect(_this.mouseDown.x, _this.mouseDown.y, pos.x - _this.mouseDown.x, pos.y - _this.mouseDown.y);
|
203
185
|
break;
|
204
186
|
case _this.moveInType.Nodes:
|
205
|
-
_this.store.data.dataResize = 0;
|
206
187
|
if (_this.activeLayer.locked()) {
|
207
188
|
break;
|
208
189
|
}
|
@@ -213,15 +194,8 @@ var Topology = (function (_super) {
|
|
213
194
|
_this.activeLayer.move(offset.x ? offset.x : x, offset.y ? offset.y : y);
|
214
195
|
_this.needCache = true;
|
215
196
|
}
|
216
|
-
const dropdownSelect = _this.activeLayer.pens.filter((ds) => {return ds.name === elementType.select && ds.selectDropdown});
|
217
|
-
if(dropdownSelect.length) {
|
218
|
-
dropdownSelect.map((dropdown) => {
|
219
|
-
setSelectElementPosition(dropdown);
|
220
|
-
})
|
221
|
-
}
|
222
197
|
break;
|
223
198
|
case _this.moveInType.ResizeCP:
|
224
|
-
_this.store.data.dataResize = 1;
|
225
199
|
var p1 = new Point(_this.mouseDown.x, _this.mouseDown.y);
|
226
200
|
var p2 = new Point(pos.x, pos.y);
|
227
201
|
var offsetX = p2.x - p1.x;
|
@@ -269,11 +243,8 @@ var Topology = (function (_super) {
|
|
269
243
|
}
|
270
244
|
}
|
271
245
|
} else {
|
272
|
-
const activeLayerPens = _this.activeLayer.pens;
|
273
|
-
const isOnlySelect = activeLayerPens.length < 2 && activeLayerPens[0].name === elementType.select && activeLayerPens[0].selectDropdown;
|
274
|
-
if(isOnlySelect) setSelectElementPosition(activeLayerPens[0]);
|
275
246
|
_this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
|
276
|
-
_this.dispatch('resizePens',
|
247
|
+
_this.dispatch('resizePens', _this.activeLayer.pens);
|
277
248
|
_this.needCache = true;
|
278
249
|
}
|
279
250
|
break;
|
@@ -314,7 +285,7 @@ var Topology = (function (_super) {
|
|
314
285
|
|
315
286
|
} else {
|
316
287
|
|
317
|
-
var arrow = _this.
|
288
|
+
var arrow = _this.data.toArrowType;
|
318
289
|
if (_this.moveIn.hoverLine) {
|
319
290
|
arrow = _this.moveIn.hoverLine.toArrow;
|
320
291
|
}
|
@@ -368,8 +339,8 @@ var Topology = (function (_super) {
|
|
368
339
|
});
|
369
340
|
};
|
370
341
|
_this.onmousedown = function (e) {
|
371
|
-
|
372
|
-
|
342
|
+
if (e.button !== 0)
|
343
|
+
return;
|
373
344
|
var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
|
374
345
|
_this.mouseDown = {x: e.x - canvasPos.x, y: e.y - canvasPos.y};
|
375
346
|
if (e.altKey) {
|
@@ -404,7 +375,7 @@ var Topology = (function (_super) {
|
|
404
375
|
break;
|
405
376
|
case _this.moveInType.LineMove:
|
406
377
|
_this.hoverLayer.initLine = new Line(_this.moveIn.hoverLine);
|
407
|
-
if (_this.
|
378
|
+
if (_this.data.locked || _this.moveIn.hoverLine.locked) {
|
408
379
|
_this.moveIn.hoverLine.click();
|
409
380
|
}
|
410
381
|
// tslint:disable-next-line:no-switch-case-fall-through
|
@@ -422,12 +393,12 @@ var Topology = (function (_super) {
|
|
422
393
|
|
423
394
|
} else {
|
424
395
|
_this.hoverLayer.line = _this.addLine({
|
425
|
-
name: _this.
|
396
|
+
name: _this.data.lineName,
|
426
397
|
from: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].direction, _this.moveIn.hoverAnchorIndex, _this.moveIn.hoverNode.id),
|
427
|
-
fromArrow: _this.
|
398
|
+
fromArrow: _this.data.fromArrowType,
|
428
399
|
to: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y),
|
429
|
-
toArrow: _this.
|
430
|
-
strokeStyle: _this.
|
400
|
+
toArrow: _this.data.toArrowType,
|
401
|
+
strokeStyle: _this.options.color,
|
431
402
|
});
|
432
403
|
_this.dispatch('anchor', {
|
433
404
|
anchor: _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex],
|
@@ -470,9 +441,10 @@ var Topology = (function (_super) {
|
|
470
441
|
const activeNode = _this.moveIn.activeNode;
|
471
442
|
if (!_this.checkNodeOfClickType(activeNode)) {
|
472
443
|
_this.activeLayer.setPens([activeNode]);
|
473
|
-
if(activeNode
|
474
|
-
|
475
|
-
|
444
|
+
if (activeNode && activeNode.name == 'arbitraryGraph') {
|
445
|
+
_this.dispatch('node', activeNode);
|
446
|
+
} else if (activeNode && activeNode.name == 'tablePagination') {
|
447
|
+
if (_this.options.type === 'topology') return _this.dispatch('node', activeNode);
|
476
448
|
const pnlKeys = Object.keys(activeNode.paginationData.pageNumberLocals);
|
477
449
|
const pageNumArea = pnlKeys.find((pna) => {
|
478
450
|
return e.offsetX - 32 < pna && e.offsetX - parseInt(pna) > 0
|
@@ -485,13 +457,20 @@ var Topology = (function (_super) {
|
|
485
457
|
if (activeNode.paginationData.pageListState) _this.spreadPageListHandle(activeNode, e);
|
486
458
|
if (activeNode.paginationData.targetPageLocal.hide) _this.targetPageInputHandle(activeNode, e);
|
487
459
|
}
|
488
|
-
}else {
|
489
|
-
_this.changeTabsState(activeNode);
|
460
|
+
} else {
|
490
461
|
_this.dispatch('node', activeNode);
|
462
|
+
if(!window.location.pathname.includes('workspace')) {
|
463
|
+
const staticTypeNode = activeNode.events.find((ev) => {
|
464
|
+
return parseInt(ev.action) === 8
|
465
|
+
}); // 若绑定的是echarts统计图事件
|
466
|
+
if (staticTypeNode) {
|
467
|
+
_this.switchStaticsCheckType(activeNode, staticTypeNode);
|
468
|
+
}
|
469
|
+
}
|
491
470
|
}
|
492
471
|
}
|
493
472
|
}
|
494
|
-
if (_this.
|
473
|
+
if (_this.data.locked || _this.moveIn.activeNode.locked) {
|
495
474
|
_this.moveIn.activeNode.click();
|
496
475
|
}
|
497
476
|
break;
|
@@ -532,10 +511,10 @@ var Topology = (function (_super) {
|
|
532
511
|
if (_this.hoverLayer.line) {
|
533
512
|
var willAddLine = void 0;
|
534
513
|
if (_this.hoverLayer.line.to.id) {
|
535
|
-
if (!_this.
|
514
|
+
if (!_this.options.disableRepeatLine) {
|
536
515
|
willAddLine = true;
|
537
516
|
} else {
|
538
|
-
var lines = _this.
|
517
|
+
var lines = _this.data.pens.filter(function (pen) {
|
539
518
|
return pen.type === PenType.Line &&
|
540
519
|
pen.from.isSameAs(_this.hoverLayer.line.from) &&
|
541
520
|
pen.to.isSameAs(_this.hoverLayer.line.to);
|
@@ -543,13 +522,13 @@ var Topology = (function (_super) {
|
|
543
522
|
willAddLine = lines.length <= 1;
|
544
523
|
}
|
545
524
|
} else {
|
546
|
-
willAddLine = !_this.
|
525
|
+
willAddLine = !_this.options.disableEmptyLine;
|
547
526
|
}
|
548
527
|
if (willAddLine) {
|
549
528
|
_this.activeLayer.pens = [_this.hoverLayer.line];
|
550
529
|
_this.dispatch('addLine', _this.hoverLayer.line);
|
551
530
|
} else {
|
552
|
-
_this.
|
531
|
+
_this.data.pens.pop();
|
553
532
|
_this.activeLayer.clear();
|
554
533
|
}
|
555
534
|
}
|
@@ -568,7 +547,7 @@ var Topology = (function (_super) {
|
|
568
547
|
(!_this.hoverLayer.line.from.id || !_this.hoverLayer.line.to.id)) {
|
569
548
|
_this.needCache = true;
|
570
549
|
_this.activeLayer.clear();
|
571
|
-
_this.
|
550
|
+
_this.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
|
572
551
|
}
|
573
552
|
break;
|
574
553
|
}
|
@@ -581,7 +560,7 @@ var Topology = (function (_super) {
|
|
581
560
|
_this.needCache = false;
|
582
561
|
};
|
583
562
|
_this.onkeydown = function (key) {
|
584
|
-
if (_this.
|
563
|
+
if (_this.data.locked ||
|
585
564
|
key.target.tagName === 'INPUT' ||
|
586
565
|
key.target.tagName === 'TEXTAREA') {
|
587
566
|
return;
|
@@ -592,7 +571,7 @@ var Topology = (function (_super) {
|
|
592
571
|
switch (key.key) {
|
593
572
|
case 'a':
|
594
573
|
case 'A':
|
595
|
-
_this.activeLayer.setPens(_this.
|
574
|
+
_this.activeLayer.setPens(_this.data.pens);
|
596
575
|
_this.dispatch('multi', _this.activeLayer.pens);
|
597
576
|
done = true;
|
598
577
|
break;
|
@@ -696,45 +675,41 @@ var Topology = (function (_super) {
|
|
696
675
|
return;
|
697
676
|
var obj = JSON.parse(json);
|
698
677
|
event.preventDefault();
|
699
|
-
if(obj.
|
700
|
-
|
701
|
-
|
702
|
-
_this.
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
}
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
_this.
|
722
|
-
|
723
|
-
_this.
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
oZindex: -1, //是否达到起点
|
728
|
-
isDragging: false, //是否在抓取
|
729
|
-
close: false, //闭合
|
730
|
-
};
|
678
|
+
if (obj.name && obj.name == 'arbitraryGraph') {
|
679
|
+
Store.set('addingArbitraryGraph', true);
|
680
|
+
_this.addingArbitraryGraph = true;
|
681
|
+
_this.dispatch('addingArbitraryGraph', true);
|
682
|
+
return
|
683
|
+
}
|
684
|
+
_this.addingArbitraryGraph = false;
|
685
|
+
Store.set('addingArbitraryGraph', false);
|
686
|
+
_this.arbitrarygGraphData = {
|
687
|
+
points: [],
|
688
|
+
circles: [],
|
689
|
+
indexCircle: 0, //当前点击的圆圈
|
690
|
+
oZindex: -1, //是否达到起点
|
691
|
+
isDragging: false, //是否在抓取
|
692
|
+
close: false, //闭合
|
693
|
+
};
|
694
|
+
if (obj.name == 'temp') {
|
695
|
+
// 温湿度元件
|
696
|
+
let activeTempNodes = []
|
697
|
+
_this.dropNodes([obj.children[0]], event.offsetX - 23.5, event.offsetY)
|
698
|
+
activeTempNodes.push(_this.activeLayer.pens[0])
|
699
|
+
_this.dropNodes([obj.children[1]], event.offsetX + 11.5, event.offsetY - 8.5)
|
700
|
+
activeTempNodes.push(_this.activeLayer.pens[0])
|
701
|
+
_this.dropNodes([obj.children[2]], event.offsetX + 11.5, event.offsetY + 8.5)
|
702
|
+
activeTempNodes.push(_this.activeLayer.pens[0])
|
703
|
+
_this.activeLayer.pens = activeTempNodes
|
704
|
+
_this.combine(activeTempNodes, null, 'temp');
|
705
|
+
} else {
|
731
706
|
_this.dropNodes(Array.isArray(obj) ? obj : [obj], event.offsetX, event.offsetY);
|
732
707
|
}
|
733
708
|
} catch (_a) {
|
734
709
|
}
|
735
710
|
};
|
736
711
|
_this.subcribeAnimateMoved = Store.subscribe(this.generateStoreKey('LT:rectChanged'), function (e) {
|
737
|
-
_this.activeLayer.updateLines(_this.
|
712
|
+
_this.activeLayer.updateLines(_this.data.pens);
|
738
713
|
});
|
739
714
|
_this.subcribeMediaEnd = Store.subscribe(this.generateStoreKey('mediaEnd'), function (node) {
|
740
715
|
if (node.nextPlay) {
|
@@ -747,7 +722,7 @@ var Topology = (function (_super) {
|
|
747
722
|
if (window.location.pathname.includes('workspace')) {
|
748
723
|
return
|
749
724
|
}
|
750
|
-
_this.hidePenByTag(_this.
|
725
|
+
_this.hidePenByTag(_this.data.pens, e);
|
751
726
|
const obj = e ? JSON.parse(e) : {}
|
752
727
|
const visibleRange = obj.visibleRange
|
753
728
|
if (visibleRange == '1') {
|
@@ -758,10 +733,10 @@ var Topology = (function (_super) {
|
|
758
733
|
_this.divLayer.canvas.onmousedown = this.onmousedown;
|
759
734
|
_this.divLayer.canvas.onmouseup = this.onmouseup;
|
760
735
|
_this.divLayer.canvas.onwheel = function (event) {
|
761
|
-
if (_this.
|
736
|
+
if (_this.options.disableScale) {
|
762
737
|
return;
|
763
738
|
}
|
764
|
-
switch (_this.
|
739
|
+
switch (_this.options.scaleKey) {
|
765
740
|
case KeyType.None:
|
766
741
|
break;
|
767
742
|
case KeyType.Ctrl:
|
@@ -785,28 +760,28 @@ var Topology = (function (_super) {
|
|
785
760
|
}
|
786
761
|
}
|
787
762
|
event.preventDefault();
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
763
|
+
if (event.deltaY < 0) {
|
764
|
+
if (event.layerX && event.layerY) {
|
765
|
+
_this.scale(1.1, {x: event.layerX, y: event.layerY});
|
766
|
+
_this.canvas.scale(1.1, {x: event.layerX, y: event.layerY});
|
767
|
+
} else {
|
768
|
+
_this.scale(1.1);
|
769
|
+
_this.canvas.scale(1.1);
|
770
|
+
}
|
771
|
+
} else {
|
772
|
+
if (event.layerX && event.layerY) {
|
773
|
+
_this.scale(0.9, {x: event.layerX, y: event.layerY});
|
774
|
+
_this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
|
775
|
+
} else {
|
776
|
+
_this.scale(0.9);
|
777
|
+
_this.canvas.scale(0.9);
|
778
|
+
}
|
779
|
+
}
|
805
780
|
_this.divLayer.canvas.focus();
|
806
781
|
return false;
|
807
782
|
};
|
808
783
|
_this.cache();
|
809
|
-
switch (_this.
|
784
|
+
switch (_this.options.keydown) {
|
810
785
|
case KeydownType.Document:
|
811
786
|
document.onkeydown = _this.onkeydown;
|
812
787
|
break;
|
@@ -820,7 +795,6 @@ var Topology = (function (_super) {
|
|
820
795
|
clearTimeout(timer);
|
821
796
|
}
|
822
797
|
timer = setTimeout(function () {
|
823
|
-
_this.resize();
|
824
798
|
_this.overflow();
|
825
799
|
_this.render();
|
826
800
|
}, 100);
|
@@ -829,26 +803,26 @@ var Topology = (function (_super) {
|
|
829
803
|
return _this;
|
830
804
|
}
|
831
805
|
// Render or redraw
|
832
|
-
Topology.prototype.render = function (noFocus) {
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
806
|
+
Topology.prototype.render = function (noFocus, type) {
|
807
|
+
try{
|
808
|
+
if (noFocus === void 0) {
|
809
|
+
noFocus = false;
|
810
|
+
}
|
811
|
+
if (noFocus) {
|
812
|
+
this.activeLayer.pens = [];
|
813
|
+
this.hoverLayer.node = null;
|
814
|
+
this.hoverLayer.line = null;
|
815
|
+
}
|
816
|
+
if (this.rendering) {
|
817
|
+
return this;
|
818
|
+
}
|
819
|
+
this.rendering = true;
|
820
|
+
this.offscreen.render();
|
821
|
+
this.canvas.render();
|
822
|
+
this.rendering = false;
|
823
|
+
}catch (e){
|
824
|
+
console.log('render-error-------------')
|
825
|
+
}
|
852
826
|
};
|
853
827
|
Topology.prototype.resize = function (size) {
|
854
828
|
this.canvasResize(size);
|
@@ -878,26 +852,58 @@ var Topology = (function (_super) {
|
|
878
852
|
}
|
879
853
|
if (json.name === 'lineAlone') {
|
880
854
|
_this.addLine({
|
881
|
-
name: _this.
|
855
|
+
name: _this.data.lineName,
|
882
856
|
from: new Point(json.rect.x, json.rect.y),
|
883
|
-
fromArrow: _this.
|
857
|
+
fromArrow: _this.data.fromArrowType,
|
884
858
|
to: new Point(json.rect.x + json.rect.width, json.rect.y + json.rect.height),
|
885
|
-
toArrow: _this.
|
886
|
-
strokeStyle: _this.
|
859
|
+
toArrow: _this.data.toArrowType,
|
860
|
+
strokeStyle: _this.options.color,
|
887
861
|
}, true);
|
888
862
|
}
|
889
863
|
|
890
864
|
if (json.name == 'define') {
|
865
|
+
|
891
866
|
// console.log('创建自定义组件 ', json);
|
867
|
+
|
892
868
|
console.log('store 中的 自定义 ', Store.get('defineNode'));
|
893
|
-
_this.
|
894
|
-
|
895
|
-
//
|
896
|
-
|
897
|
-
|
869
|
+
if (_this.data.locked) return
|
870
|
+
// let defineNode = Store.get('defineNode');
|
871
|
+
// let nodesList = Store.get('defineNode').pens;
|
872
|
+
let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
|
873
|
+
let nodesList = defineNode.pens;
|
874
|
+
|
875
|
+
let renderNodesList = [];
|
876
|
+
|
877
|
+
for (let i = 0, len = nodesList.length; i < len; i++) {
|
878
|
+
|
879
|
+
nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
|
880
|
+
|
881
|
+
nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
|
882
|
+
|
883
|
+
let node = new Node(nodesList[i]);
|
884
|
+
|
885
|
+
node.setTID(s8());
|
886
|
+
node.id = s8();
|
887
|
+
node.fileId = defineNode.fileId;
|
888
|
+
|
889
|
+
// console.log('push之前的node', node);
|
890
|
+
|
891
|
+
_this.data.pens.push(node);
|
892
|
+
|
893
|
+
renderNodesList.push(node);
|
894
|
+
}
|
895
|
+
_this.activeLayer.setPens([renderNodesList[0]]);
|
896
|
+
|
897
|
+
_this.render(false);
|
898
|
+
|
899
|
+
_this.animate(true);
|
900
|
+
|
901
|
+
_this.cache();
|
902
|
+
|
903
|
+
_this.dispatch('addNode', renderNodesList[0]);
|
904
|
+
|
905
|
+
} else {
|
898
906
|
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
907
|
node.setTID(_this.id);
|
902
908
|
node.clearChildrenIds();
|
903
909
|
_this.addNode(node, true);
|
@@ -905,7 +911,7 @@ var Topology = (function (_super) {
|
|
905
911
|
_this.dispatch('LT:addDiv', node);
|
906
912
|
}
|
907
913
|
if (node.name === 'formTable') {
|
908
|
-
_this.
|
914
|
+
_this.data.dataConstruct[node.id] = {
|
909
915
|
id: node.id,
|
910
916
|
name: 'table'
|
911
917
|
}
|
@@ -914,123 +920,36 @@ var Topology = (function (_super) {
|
|
914
920
|
});
|
915
921
|
this.divLayer.canvas.focus();
|
916
922
|
};
|
917
|
-
Topology.prototype.
|
918
|
-
const item = new Node(node);
|
919
|
-
item.setTID(this.id);
|
920
|
-
item.clearChildrenIds();
|
921
|
-
return item;
|
922
|
-
};
|
923
|
-
Topology.prototype.changeTabsState = function (node) {
|
924
|
-
if(this.nodeId === node.id) return;
|
925
|
-
this.nodeId = node.id;
|
926
|
-
this.isTabHideShow = node.events && node.events.some((ev) => {return ev.action === 8 && ev.dcimStaticForType === 'SH'});
|
927
|
-
if(!this.isTabHideShow) return;
|
928
|
-
// tab显示隐藏
|
929
|
-
const pens = this.store.data.pens;
|
930
|
-
// 重置tabs数据
|
931
|
-
for (let i = 0, pensLength = pens.length; i < pensLength; i++) {
|
932
|
-
pens[i].order = i;
|
933
|
-
setConnectionTabsData(pens[i]);
|
934
|
-
}
|
935
|
-
this.switchStaticsCheckType(node, {dcimStaticForType: 'SH'});
|
936
|
-
};
|
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
|
-
// 添加自定义元件
|
962
|
-
Topology.prototype.dropDefineNode = function(josn, offsetX, offsetY) {
|
963
|
-
var _this = this;
|
964
|
-
if (_this.store.data.locked) return
|
965
|
-
// let defineNode = Store.get('defineNode');
|
966
|
-
// let nodesList = Store.get('defineNode').pens;
|
967
|
-
let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
|
968
|
-
let nodesList = defineNode.pens;
|
969
|
-
|
970
|
-
let renderNodesList = [];
|
971
|
-
|
972
|
-
for (let i = 0, len = nodesList.length; i < len; i++) {
|
973
|
-
|
974
|
-
nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
|
975
|
-
|
976
|
-
nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
|
977
|
-
|
978
|
-
let node = new Node(nodesList[i]);
|
979
|
-
|
980
|
-
node.setTID(s8());
|
981
|
-
node.id = s8();
|
982
|
-
node.fileId = defineNode.fileId;
|
983
|
-
|
984
|
-
// console.log('push之前的node', node);
|
985
|
-
|
986
|
-
_this.store.data.pens.push(node);
|
987
|
-
|
988
|
-
renderNodesList.push(node);
|
989
|
-
}
|
990
|
-
_this.activeLayer.setPens([renderNodesList[0]]);
|
991
|
-
|
992
|
-
_this.render(false);
|
993
|
-
|
994
|
-
_this.animate(true);
|
995
|
-
|
996
|
-
_this.cache();
|
997
|
-
|
998
|
-
_this.dispatch('addNode', renderNodesList[0]);
|
999
|
-
};
|
1000
|
-
Topology.prototype.addNode = function (node, focus, visit) {
|
923
|
+
Topology.prototype.addNode = function (node, focus) {
|
1001
924
|
if (focus === void 0) {
|
1002
925
|
focus = false;
|
1003
926
|
}
|
1004
|
-
if (this.
|
927
|
+
if (this.data.locked || !drawNodeFns[node.name]) {
|
1005
928
|
return null;
|
1006
929
|
}
|
1007
930
|
// if it's not a Node
|
1008
931
|
if (!node.init) {
|
1009
932
|
node = new Node(node);
|
1010
933
|
}
|
1011
|
-
if (!node.strokeStyle && this.
|
1012
|
-
node.strokeStyle = this.
|
934
|
+
if (!node.strokeStyle && this.options.color) {
|
935
|
+
node.strokeStyle = this.options.color;
|
1013
936
|
}
|
1014
937
|
for (var key in node.font) {
|
1015
938
|
if (!node.font[key]) {
|
1016
|
-
node.font[key] = this.
|
939
|
+
node.font[key] = this.options.font[key];
|
1017
940
|
}
|
1018
941
|
}
|
1019
|
-
if (this.
|
1020
|
-
node.scale(this.
|
942
|
+
if (this.data.scale !== 1) {
|
943
|
+
node.scale(this.data.scale);
|
1021
944
|
}
|
1022
|
-
node
|
1023
|
-
node
|
1024
|
-
this.store.data.pens.push(node);
|
1025
|
-
setConnectionTagForConf(node);
|
945
|
+
this.data.pens.push(node);
|
946
|
+
this.setSwitchTabData(node, this.data.pens.length-1);
|
1026
947
|
if (focus) {
|
948
|
+
this.activeLayer.setPens([node]);
|
1027
949
|
this.render();
|
1028
950
|
this.animate(true);
|
1029
951
|
this.cache();
|
1030
|
-
|
1031
|
-
this.activeLayer.setPens([node]);
|
1032
|
-
this.dispatch('addNode', node);
|
1033
|
-
}
|
952
|
+
this.dispatch('addNode', node);
|
1034
953
|
}
|
1035
954
|
return node;
|
1036
955
|
};
|
@@ -1038,14 +957,14 @@ var Topology = (function (_super) {
|
|
1038
957
|
if (focus === void 0) {
|
1039
958
|
focus = false;
|
1040
959
|
}
|
1041
|
-
if (this.
|
960
|
+
if (this.data.locked) {
|
1042
961
|
return null;
|
1043
962
|
}
|
1044
963
|
if (!line.clone) {
|
1045
964
|
line = new Line(line);
|
1046
965
|
line.calcControlPoints(true);
|
1047
966
|
}
|
1048
|
-
this.
|
967
|
+
this.data.pens.push(line);
|
1049
968
|
if (focus) {
|
1050
969
|
this.activeLayer.setPens([line]);
|
1051
970
|
this.render();
|
@@ -1058,10 +977,10 @@ var Topology = (function (_super) {
|
|
1058
977
|
// open - redraw by the data
|
1059
978
|
Topology.prototype.open = function (topoJSon) {
|
1060
979
|
this.conversionData(topoJSon);
|
1061
|
-
Store.set(this.generateStoreKey('LT:scale'), this.
|
1062
|
-
this.dispatch('scale', this.
|
1063
|
-
this.
|
1064
|
-
this.
|
980
|
+
Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
|
981
|
+
this.dispatch('scale', this.data.scale);
|
982
|
+
this.parentElem.scrollLeft = 0;
|
983
|
+
this.parentElem.scrollTop = 0;
|
1065
984
|
this.caches.list = [];
|
1066
985
|
this.divLayer.clear();
|
1067
986
|
this.cache();
|
@@ -1071,22 +990,22 @@ var Topology = (function (_super) {
|
|
1071
990
|
this.showGrid();
|
1072
991
|
};
|
1073
992
|
Topology.prototype.overflow = function () {
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
}
|
1085
|
-
this.resize({width: width, height: height});
|
1086
|
-
return rect;
|
1087
|
-
}catch (e){
|
1088
|
-
//console.log('init-error-----------',e)
|
993
|
+
try {
|
994
|
+
var rect = this.getRect();
|
995
|
+
let _a = this.canvas;
|
996
|
+
if(!_a.width) return;
|
997
|
+
let width = _a.width, height = _a.height;
|
998
|
+
if (width < rect.width) {
|
999
|
+
width = rect.width;
|
1000
|
+
}
|
1001
|
+
if (height < rect.height) {
|
1002
|
+
height = rect.height;
|
1089
1003
|
}
|
1004
|
+
this.resize({width: width, height: height});
|
1005
|
+
return rect;
|
1006
|
+
}catch (e){
|
1007
|
+
console.log('init-error-----------')
|
1008
|
+
}
|
1090
1009
|
};
|
1091
1010
|
Topology.prototype.getMoveIn = function (pt) {
|
1092
1011
|
this.lastHoverNode = this.moveIn.hoverNode;
|
@@ -1096,13 +1015,13 @@ var Topology = (function (_super) {
|
|
1096
1015
|
this.moveIn.lineControlPoint = null;
|
1097
1016
|
this.moveIn.hoverLine = null;
|
1098
1017
|
this.hoverLayer.hoverAnchorIndex = -1;
|
1099
|
-
if (!this.
|
1018
|
+
if (!this.data.locked &&
|
1100
1019
|
!(this.activeLayer.pens.length === 1 && this.activeLayer.pens[0].type) &&
|
1101
1020
|
!this.activeLayer.locked() &&
|
1102
1021
|
this.activeLayer.rotateCPs[0] &&
|
1103
1022
|
this.activeLayer.rotateCPs[0].hit(pt, 15)) {
|
1104
1023
|
this.moveIn.type = this.moveInType.Rotate;
|
1105
|
-
var cursor = this.
|
1024
|
+
var cursor = this.options.rotateCursor;
|
1106
1025
|
this.divLayer.canvas.style.cursor = cursor.includes('/')
|
1107
1026
|
? "url(\"" + cursor + "\"), auto"
|
1108
1027
|
: cursor;
|
@@ -1112,9 +1031,9 @@ var Topology = (function (_super) {
|
|
1112
1031
|
pointInRect(pt, this.activeLayer.sizeCPs)) {
|
1113
1032
|
this.moveIn.type = this.moveInType.Nodes;
|
1114
1033
|
}
|
1115
|
-
if (!this.
|
1034
|
+
if (!this.data.locked &&
|
1116
1035
|
!this.activeLayer.locked() &&
|
1117
|
-
!this.
|
1036
|
+
!this.options.hideSizeCP) {
|
1118
1037
|
if (this.activeLayer.pens.length > 1 ||
|
1119
1038
|
(!this.activeLayer.pens[0].type && !this.activeLayer.pens[0].hideSizeCP)) {
|
1120
1039
|
for (var i = 0; i < this.activeLayer.sizeCPs.length; ++i) {
|
@@ -1127,8 +1046,8 @@ var Topology = (function (_super) {
|
|
1127
1046
|
}
|
1128
1047
|
}
|
1129
1048
|
}
|
1130
|
-
// In active pen.
|
1131
|
-
if (!this.
|
1049
|
+
// In active pen.
|
1050
|
+
if (!this.data.locked) {
|
1132
1051
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1133
1052
|
var item = _a[_i];
|
1134
1053
|
if (item instanceof Line && !item.locked) {
|
@@ -1148,19 +1067,16 @@ var Topology = (function (_super) {
|
|
1148
1067
|
}
|
1149
1068
|
}
|
1150
1069
|
}
|
1151
|
-
this.store.data.dataResize = 1;
|
1152
1070
|
this.divLayer.canvas.style.cursor = 'default';
|
1153
|
-
var len = this.
|
1071
|
+
var len = this.data.pens.length;
|
1154
1072
|
for (var i = len - 1; i > -1; --i) {
|
1155
|
-
if(this.
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
// return;
|
1163
|
-
}
|
1073
|
+
if (this.data.pens[i].type === PenType.Node &&
|
1074
|
+
this.inNode(pt, this.data.pens[i])) {
|
1075
|
+
return;
|
1076
|
+
} else if (this.data.pens[i].type === PenType.Line &&
|
1077
|
+
this.inLine(pt, this.data.pens[i])) {
|
1078
|
+
// 需要优先判断十分在节点锚点上
|
1079
|
+
// return;
|
1164
1080
|
}
|
1165
1081
|
}
|
1166
1082
|
};
|
@@ -1191,7 +1107,7 @@ var Topology = (function (_super) {
|
|
1191
1107
|
if (inChild === void 0) {
|
1192
1108
|
inChild = false;
|
1193
1109
|
}
|
1194
|
-
if (this.
|
1110
|
+
if (this.data.locked === Lock.NoEvent ||
|
1195
1111
|
(!node.visible && !window.location.pathname.includes('workspace')) ||
|
1196
1112
|
node.locked === Lock.NoEvent) {
|
1197
1113
|
return null;
|
@@ -1212,22 +1128,21 @@ var Topology = (function (_super) {
|
|
1212
1128
|
}
|
1213
1129
|
return child;
|
1214
1130
|
}
|
1215
|
-
if(!(node instanceof Node)) node = new Node(node);
|
1216
1131
|
if (node.hit(pt)) {
|
1217
1132
|
this.moveIn.hoverNode = node;
|
1218
1133
|
this.moveIn.type = this.moveInType.Nodes;
|
1219
1134
|
// 非绘画页面下禁止不包含点击、双击事件的节点选中鼠标样式
|
1220
1135
|
if (!this.checkNodeOfClickType(node)) {
|
1221
|
-
if (!this.
|
1136
|
+
if (!this.data.locked && !node.locked) {
|
1222
1137
|
this.divLayer.canvas.style.cursor = 'move';
|
1223
1138
|
} else {
|
1224
|
-
this.divLayer.canvas.style.cursor = this.
|
1139
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1225
1140
|
}
|
1226
1141
|
}
|
1227
1142
|
// Too small
|
1228
|
-
if (!this.
|
1143
|
+
if (!this.data.locked &&
|
1229
1144
|
!node.locked &&
|
1230
|
-
!(this.
|
1145
|
+
!(this.options.hideAnchor ||
|
1231
1146
|
node.hideAnchor ||
|
1232
1147
|
node.rect.width < 20 ||
|
1233
1148
|
node.rect.height < 20)) {
|
@@ -1250,9 +1165,9 @@ var Topology = (function (_super) {
|
|
1250
1165
|
}
|
1251
1166
|
return node;
|
1252
1167
|
}
|
1253
|
-
if (this.
|
1168
|
+
if (this.options.hideAnchor ||
|
1254
1169
|
node.hideAnchor ||
|
1255
|
-
this.
|
1170
|
+
this.data.locked ||
|
1256
1171
|
node.locked) {
|
1257
1172
|
return null;
|
1258
1173
|
}
|
@@ -1284,8 +1199,8 @@ var Topology = (function (_super) {
|
|
1284
1199
|
if (line.from.hit(point, 5)) {
|
1285
1200
|
this.moveIn.type = this.moveInType.LineFrom;
|
1286
1201
|
this.moveIn.hoverLine = line;
|
1287
|
-
if (this.
|
1288
|
-
this.divLayer.canvas.style.cursor = this.
|
1202
|
+
if (this.data.locked || line.locked) {
|
1203
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1289
1204
|
} else {
|
1290
1205
|
this.divLayer.canvas.style.cursor = 'move';
|
1291
1206
|
}
|
@@ -1294,8 +1209,8 @@ var Topology = (function (_super) {
|
|
1294
1209
|
if (line.to.hit(point, 5)) {
|
1295
1210
|
this.moveIn.type = this.moveInType.LineTo;
|
1296
1211
|
this.moveIn.hoverLine = line;
|
1297
|
-
if (this.
|
1298
|
-
this.divLayer.canvas.style.cursor = this.
|
1212
|
+
if (this.data.locked || line.locked) {
|
1213
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1299
1214
|
} else {
|
1300
1215
|
this.divLayer.canvas.style.cursor = 'move';
|
1301
1216
|
}
|
@@ -1304,7 +1219,7 @@ var Topology = (function (_super) {
|
|
1304
1219
|
if (line.pointIn(point)) {
|
1305
1220
|
this.moveIn.type = this.moveInType.LineMove;
|
1306
1221
|
this.moveIn.hoverLine = line;
|
1307
|
-
this.divLayer.canvas.style.cursor = this.
|
1222
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1308
1223
|
if (line.from.id || line.to.id) {
|
1309
1224
|
this.moveIn.type = this.moveInType.Line;
|
1310
1225
|
}
|
@@ -1314,7 +1229,7 @@ var Topology = (function (_super) {
|
|
1314
1229
|
};
|
1315
1230
|
Topology.prototype.getLineDock = function (point) {
|
1316
1231
|
this.hoverLayer.dockAnchor = null;
|
1317
|
-
for (var _i = 0, _a = this.
|
1232
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1318
1233
|
var item = _a[_i];
|
1319
1234
|
if (item instanceof Node) {
|
1320
1235
|
if (item.rect.hit(point, 10)) {
|
@@ -1381,7 +1296,7 @@ var Topology = (function (_super) {
|
|
1381
1296
|
rect.ey = rect.y + rect.height;
|
1382
1297
|
}
|
1383
1298
|
this.activeLayer.pens = [];
|
1384
|
-
for (var _i = 0, _a = this.
|
1299
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1385
1300
|
var item = _a[_i];
|
1386
1301
|
if (item.locked === Lock.NoEvent) {
|
1387
1302
|
continue;
|
@@ -1428,7 +1343,7 @@ var Topology = (function (_super) {
|
|
1428
1343
|
x: 0,
|
1429
1344
|
y: 0,
|
1430
1345
|
};
|
1431
|
-
if (noDock || this.
|
1346
|
+
if (noDock || this.options.disableDockLine) {
|
1432
1347
|
return offset;
|
1433
1348
|
}
|
1434
1349
|
var x = 0;
|
@@ -1437,7 +1352,7 @@ var Topology = (function (_super) {
|
|
1437
1352
|
var disY = dockOffset;
|
1438
1353
|
for (var _i = 0, _a = this.activeLayer.dockWatchers; _i < _a.length; _i++) {
|
1439
1354
|
var activePt = _a[_i];
|
1440
|
-
for (var _b = 0, _c = this.
|
1355
|
+
for (var _b = 0, _c = this.data.pens; _b < _c.length; _b++) {
|
1441
1356
|
var item = _c[_b];
|
1442
1357
|
if (!(item instanceof Node) ||
|
1443
1358
|
this.activeLayer.has(item) ||
|
@@ -1470,9 +1385,9 @@ var Topology = (function (_super) {
|
|
1470
1385
|
if (this.caches.index < this.caches.list.length - 1) {
|
1471
1386
|
this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
|
1472
1387
|
}
|
1473
|
-
var data =
|
1388
|
+
var data = new TopologyData(this.data);
|
1474
1389
|
this.caches.list.push(data);
|
1475
|
-
if (this.caches.list.length > this.
|
1390
|
+
if (this.caches.list.length > this.options.cacheLen) {
|
1476
1391
|
this.caches.list.shift();
|
1477
1392
|
}
|
1478
1393
|
this.caches.index = this.caches.list.length - 1;
|
@@ -1505,31 +1420,31 @@ var Topology = (function (_super) {
|
|
1505
1420
|
if (noRedo === void 0) {
|
1506
1421
|
noRedo = false;
|
1507
1422
|
}
|
1508
|
-
if (this.
|
1423
|
+
if (this.data.locked || this.caches.index < 1) {
|
1509
1424
|
return;
|
1510
1425
|
}
|
1511
1426
|
this.divLayer.clear();
|
1512
|
-
var data =
|
1513
|
-
this.
|
1514
|
-
this.
|
1427
|
+
var data = new TopologyData(this.caches.list[--this.caches.index]);
|
1428
|
+
this.data.pens.splice(0, this.data.pens.length);
|
1429
|
+
this.data.pens.push.apply(this.data.pens, data.pens);
|
1515
1430
|
this.render(true);
|
1516
1431
|
this.divLayer.render();
|
1517
1432
|
if (noRedo) {
|
1518
1433
|
this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
|
1519
1434
|
}
|
1520
|
-
this.dispatch('undo', this.
|
1435
|
+
this.dispatch('undo', this.data);
|
1521
1436
|
};
|
1522
1437
|
Topology.prototype.redo = function () {
|
1523
|
-
if (this.
|
1438
|
+
if (this.data.locked || this.caches.index > this.caches.list.length - 2) {
|
1524
1439
|
return;
|
1525
1440
|
}
|
1526
1441
|
this.divLayer.clear();
|
1527
|
-
var data =
|
1528
|
-
this.
|
1529
|
-
this.
|
1442
|
+
var data = new TopologyData(this.caches.list[++this.caches.index]);
|
1443
|
+
this.data.pens.splice(0, this.data.pens.length);
|
1444
|
+
this.data.pens.push.apply(this.data.pens, data.pens);
|
1530
1445
|
this.render(true);
|
1531
1446
|
this.divLayer.render();
|
1532
|
-
this.dispatch('redo', this.
|
1447
|
+
this.dispatch('redo', this.data);
|
1533
1448
|
};
|
1534
1449
|
Topology.prototype.toImage = function (type, quality, callback, padding, thumbnail) {
|
1535
1450
|
if (thumbnail === void 0) {
|
@@ -1585,14 +1500,7 @@ var Topology = (function (_super) {
|
|
1585
1500
|
};
|
1586
1501
|
Topology.prototype.delete = function (force, nodes) {
|
1587
1502
|
var pens = [];
|
1588
|
-
|
1589
|
-
if(this.isTabHideShow) {
|
1590
|
-
// 如果删除的是tab显示隐藏元件
|
1591
|
-
deleteNodes = getTabConnectSHConf(this.activeLayer.pens[0]);
|
1592
|
-
this.activeLayer.pens = [];
|
1593
|
-
}else {
|
1594
|
-
deleteNodes = nodes ? nodes : this.activeLayer.pens;
|
1595
|
-
}
|
1503
|
+
const deleteNodes = nodes ? nodes : this.activeLayer.pens;
|
1596
1504
|
for (var i = 0; i < deleteNodes.length; i++) {
|
1597
1505
|
var pen = deleteNodes[i];
|
1598
1506
|
if (!force && pen.locked) {
|
@@ -1600,14 +1508,14 @@ var Topology = (function (_super) {
|
|
1600
1508
|
}
|
1601
1509
|
var found = this.findIndex(pen);
|
1602
1510
|
if (found > -1) {
|
1603
|
-
if (this.
|
1604
|
-
this.divLayer.removeDiv(this.
|
1511
|
+
if (this.data.pens[found].type === PenType.Node) {
|
1512
|
+
this.divLayer.removeDiv(this.data.pens[found]);
|
1605
1513
|
}
|
1606
|
-
if (this.
|
1514
|
+
if (this.options.disableEmptyLine) {
|
1607
1515
|
this.delEmptyLines(pen.id);
|
1608
1516
|
}
|
1609
|
-
pens.push.apply(pens, this.
|
1610
|
-
|
1517
|
+
pens.push.apply(pens, this.data.pens.splice(found, 1));
|
1518
|
+
this.setSwitchTabData(pen, found, 'delete');
|
1611
1519
|
--i;
|
1612
1520
|
}
|
1613
1521
|
this.animateLayer.pens.delete(pen.id);
|
@@ -1620,16 +1528,16 @@ var Topology = (function (_super) {
|
|
1620
1528
|
this.dispatch('delete', pens);
|
1621
1529
|
};
|
1622
1530
|
Topology.prototype.delEmptyLines = function (deleteedId) {
|
1623
|
-
for (var i = 0; i < this.
|
1624
|
-
if (this.
|
1531
|
+
for (var i = 0; i < this.data.pens.length; i++) {
|
1532
|
+
if (this.data.pens[i].type !== PenType.Line) {
|
1625
1533
|
continue;
|
1626
1534
|
}
|
1627
|
-
var line = this.
|
1535
|
+
var line = this.data.pens[i];
|
1628
1536
|
if (!line.from.id ||
|
1629
1537
|
!line.to.id ||
|
1630
1538
|
line.from.id === deleteedId ||
|
1631
1539
|
line.to.id === deleteedId) {
|
1632
|
-
this.
|
1540
|
+
this.data.pens.splice(i, 1);
|
1633
1541
|
this.animateLayer.pens.delete(line.id);
|
1634
1542
|
--i;
|
1635
1543
|
}
|
@@ -1638,8 +1546,8 @@ var Topology = (function (_super) {
|
|
1638
1546
|
Topology.prototype.removeNode = function (node) {
|
1639
1547
|
var i = this.findIndex(node);
|
1640
1548
|
if (i > -1) {
|
1641
|
-
this.divLayer.removeDiv(this.
|
1642
|
-
var nodes = this.
|
1549
|
+
this.divLayer.removeDiv(this.data.pens[i]);
|
1550
|
+
var nodes = this.data.pens.splice(i, 1);
|
1643
1551
|
this.dispatch('delete', nodes);
|
1644
1552
|
}
|
1645
1553
|
this.render(true);
|
@@ -1648,28 +1556,28 @@ var Topology = (function (_super) {
|
|
1648
1556
|
Topology.prototype.removeLine = function (line) {
|
1649
1557
|
var i = this.findIndex(line);
|
1650
1558
|
if (i > -1) {
|
1651
|
-
var lines = this.
|
1559
|
+
var lines = this.data.pens.splice(i, 1);
|
1652
1560
|
this.dispatch('delete', lines);
|
1653
1561
|
}
|
1654
1562
|
this.render(true);
|
1655
1563
|
this.cache();
|
1656
1564
|
};
|
1657
1565
|
Topology.prototype.cut = function () {
|
1658
|
-
if (this.
|
1566
|
+
if (this.data.locked) {
|
1659
1567
|
return;
|
1660
1568
|
}
|
1661
|
-
this.clipboard = {
|
1569
|
+
this.clipboard = new TopologyData({
|
1662
1570
|
pens: [],
|
1663
|
-
};
|
1571
|
+
});
|
1664
1572
|
for (var i = 0; i < this.activeLayer.pens.length; i++) {
|
1665
1573
|
var pen = this.activeLayer.pens[i];
|
1666
1574
|
this.clipboard.pens.push(pen.clone());
|
1667
1575
|
var found = this.findIndex(pen);
|
1668
1576
|
if (found > -1) {
|
1669
1577
|
if (pen.type === PenType.Node) {
|
1670
|
-
this.divLayer.removeDiv(this.
|
1578
|
+
this.divLayer.removeDiv(this.data.pens[found]);
|
1671
1579
|
}
|
1672
|
-
this.
|
1580
|
+
this.data.pens.splice(found, 1);
|
1673
1581
|
--i;
|
1674
1582
|
}
|
1675
1583
|
}
|
@@ -1686,9 +1594,9 @@ var Topology = (function (_super) {
|
|
1686
1594
|
return item.animatePlay;
|
1687
1595
|
});
|
1688
1596
|
if(isAnimate) return false;
|
1689
|
-
this.clipboard = {
|
1597
|
+
this.clipboard = new TopologyData({
|
1690
1598
|
pens: [],
|
1691
|
-
};
|
1599
|
+
});
|
1692
1600
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1693
1601
|
var pen = _a[_i];
|
1694
1602
|
this.clipboard.pens.push(pen.clone());
|
@@ -1696,7 +1604,7 @@ var Topology = (function (_super) {
|
|
1696
1604
|
return true;
|
1697
1605
|
};
|
1698
1606
|
Topology.prototype.paste = function () {
|
1699
|
-
if (!this.clipboard || this.
|
1607
|
+
if (!this.clipboard || this.data.locked) {
|
1700
1608
|
return;
|
1701
1609
|
}
|
1702
1610
|
this.hoverLayer.node = null;
|
@@ -1737,10 +1645,9 @@ var Topology = (function (_super) {
|
|
1737
1645
|
}
|
1738
1646
|
pen.controlPoints = controlPoints;
|
1739
1647
|
}
|
1740
|
-
|
1741
|
-
this.store.data.pens.push(pen);
|
1648
|
+
this.data.pens.push(pen);
|
1742
1649
|
this.activeLayer.add(pen);
|
1743
|
-
|
1650
|
+
this.setSwitchTabData(pen, this.data.pens.length-1);
|
1744
1651
|
}
|
1745
1652
|
this.render();
|
1746
1653
|
this.animate(true);
|
@@ -1759,41 +1666,62 @@ var Topology = (function (_super) {
|
|
1759
1666
|
}
|
1760
1667
|
};
|
1761
1668
|
Topology.prototype.bind = function (item, exite, dataType, index) {
|
1762
|
-
this.clipboard = {
|
1669
|
+
this.clipboard = new TopologyData({
|
1763
1670
|
pens: [],
|
1764
|
-
};
|
1671
|
+
});
|
1765
1672
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1766
1673
|
var pen = _a[_i];
|
1767
|
-
pen.data = []
|
1768
|
-
this.bindInfo(item, pen, dataType, index
|
1674
|
+
pen.data = []
|
1675
|
+
this.bindInfo(item, pen, dataType, index)
|
1769
1676
|
this.clipboard.pens.push(pen.clone());
|
1770
1677
|
}
|
1771
1678
|
if (exite == true) {
|
1772
1679
|
this.paste();
|
1773
1680
|
}
|
1774
1681
|
};
|
1775
|
-
Topology.prototype.bindInfo = async function (item, pen, type, index
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1682
|
+
Topology.prototype.bindInfo = async function (item, pen, type, index) {
|
1683
|
+
if (type == 0) {
|
1684
|
+
pen.data.push({
|
1685
|
+
"key": "tagId",
|
1686
|
+
"value": item.tagId,
|
1687
|
+
"isControlDis": item.isControlDis,
|
1688
|
+
"type": item.tagType,
|
1689
|
+
"tagVal": item.value,
|
1690
|
+
"valExplain": item.valExplain,
|
1691
|
+
"tagId": item.tagId
|
1692
|
+
}, {
|
1693
|
+
"key": "测点名称",
|
1694
|
+
"value": item.tagName
|
1695
|
+
})
|
1696
|
+
let obj = {
|
1697
|
+
"key": "threeCategoryId",
|
1698
|
+
"value": item.threeCategoryId
|
1699
|
+
}
|
1782
1700
|
// 绑定悬浮文字
|
1783
|
-
pen.title =
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
} else if (
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1701
|
+
pen.title = item.touchpname
|
1702
|
+
if (!JSON.stringify(pen.data).includes(JSON.stringify(obj))) {
|
1703
|
+
pen.data.push(obj)
|
1704
|
+
}
|
1705
|
+
} else if (type == 1) {
|
1706
|
+
pen.data.push({
|
1707
|
+
"key": "kpiAddr",
|
1708
|
+
"value": item.kpiId + '_' + item.kpiAddr,
|
1709
|
+
"isControlDis": item.isControlDis,
|
1710
|
+
"type": item.tagType
|
1711
|
+
}, {
|
1712
|
+
"key": "指标名称",
|
1713
|
+
"value": item.kpiName
|
1714
|
+
})
|
1715
|
+
} else if (type == 2) {
|
1716
|
+
pen.data.push({
|
1717
|
+
"key": "assetId",
|
1718
|
+
"value": item.id
|
1719
|
+
}, {
|
1720
|
+
"key": "资产名称",
|
1721
|
+
"value": item.name
|
1722
|
+
})
|
1795
1723
|
// 绑定悬浮文字
|
1796
|
-
pen.title =
|
1724
|
+
pen.title = item.bak
|
1797
1725
|
if (pen.subName && pen.subName == 'temp') {
|
1798
1726
|
// 温湿度元件
|
1799
1727
|
// 通讯状态
|
@@ -1801,19 +1729,23 @@ var Topology = (function (_super) {
|
|
1801
1729
|
if (index > 0) {
|
1802
1730
|
pen.children[0].text = index + 1 + '#'
|
1803
1731
|
}
|
1804
|
-
this.bindInfo(
|
1805
|
-
//
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1732
|
+
this.bindInfo(item, pen.children[0], type);
|
1733
|
+
// 温度/湿度
|
1734
|
+
const _type = 0
|
1735
|
+
const ret = await axios.post('/asset/touch_css3000_api/findlist', {assetIds: item.id})
|
1736
|
+
ret.data.data.forEach((elem) => {
|
1737
|
+
// if(elem.kpiName=='通讯状态'){
|
1738
|
+
// }else
|
1739
|
+
if (elem.kpiName == '温度') {
|
1740
|
+
pen.children[1].data = []
|
1741
|
+
this.bindInfo(elem, pen.children[1], _type);
|
1742
|
+
} else if (elem.kpiName == '湿度') {
|
1743
|
+
pen.children[2].data = []
|
1744
|
+
this.bindInfo(elem, pen.children[2], _type);
|
1745
|
+
}
|
1746
|
+
})
|
1747
|
+
pen.children.forEach((item) => {
|
1748
|
+
item.events = [{
|
1817
1749
|
"type": 3,
|
1818
1750
|
"action": 2,
|
1819
1751
|
"value": "",
|
@@ -1821,27 +1753,23 @@ var Topology = (function (_super) {
|
|
1821
1753
|
}]
|
1822
1754
|
})
|
1823
1755
|
}
|
1824
|
-
} else if (
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
}
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
//
|
1839
|
-
//
|
1840
|
-
|
1841
|
-
//
|
1842
|
-
// pen.data.push(...setThreeCategory);
|
1843
|
-
// }
|
1844
|
-
return pen;
|
1756
|
+
} else if (type == 3) {
|
1757
|
+
pen.data.push({
|
1758
|
+
"key": "areaId",
|
1759
|
+
"value": item.id
|
1760
|
+
}, {
|
1761
|
+
"key": "区域名称",
|
1762
|
+
"value": item.name
|
1763
|
+
})
|
1764
|
+
}
|
1765
|
+
// let str = JSON.stringify(pen.events)
|
1766
|
+
// pen.events.forEach((_item) => {
|
1767
|
+
// if(_item.action==0 && _item.dcimDetailPage && _item.dcimDetailPage != '' && item.devId){
|
1768
|
+
// str = str.replace(new RegExp(_item.dcimAssetValue,'g'), item.devId)
|
1769
|
+
// }
|
1770
|
+
// });
|
1771
|
+
// pen.events = JSON.parse(str)
|
1772
|
+
return pen
|
1845
1773
|
};
|
1846
1774
|
Topology.prototype.newId = function (node, idMaps) {
|
1847
1775
|
var old = node.id;
|
@@ -1861,12 +1789,10 @@ var Topology = (function (_super) {
|
|
1861
1789
|
if (!pens) {
|
1862
1790
|
pens = this.activeLayer.pens;
|
1863
1791
|
}
|
1864
|
-
let isAnimate = false;
|
1865
1792
|
for (var _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
|
1866
1793
|
var pen = pens_1[_i];
|
1867
1794
|
if (pen instanceof Node) {
|
1868
1795
|
let isRotateBug = false
|
1869
|
-
isAnimate = pen.animateFrames && pen.animateFrames.length
|
1870
1796
|
if (pen.rotate === 0) {
|
1871
1797
|
pen.rotate = 360
|
1872
1798
|
isRotateBug = true
|
@@ -1885,20 +1811,19 @@ var Topology = (function (_super) {
|
|
1885
1811
|
this.activeLayer.calcControlPoints();
|
1886
1812
|
this.activeLayer.saveNodeRects();
|
1887
1813
|
this.render();
|
1888
|
-
if(isAnimate) this.animate(true);
|
1889
1814
|
// tslint:disable-next-line: no-unused-expression
|
1890
1815
|
cache && this.cache();
|
1891
1816
|
};
|
1892
1817
|
Topology.prototype.lock = function (lock) {
|
1893
|
-
this.
|
1894
|
-
for (var _i = 0, _a = this.
|
1818
|
+
this.data.locked = lock;
|
1819
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1895
1820
|
var item = _a[_i];
|
1896
1821
|
item.addToDiv && item.addToDiv();
|
1897
1822
|
}
|
1898
|
-
this.dispatch('locked', this.
|
1823
|
+
this.dispatch('locked', this.data.locked);
|
1899
1824
|
};
|
1900
1825
|
Topology.prototype.lockPens = function (pens, lock) {
|
1901
|
-
for (var _i = 0, _a = this.
|
1826
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1902
1827
|
var item = _a[_i];
|
1903
1828
|
for (var _b = 0, pens_2 = pens; _b < pens_2.length; _b++) {
|
1904
1829
|
var pen = pens_2[_b];
|
@@ -1916,33 +1841,33 @@ var Topology = (function (_super) {
|
|
1916
1841
|
};
|
1917
1842
|
Topology.prototype.up = function (pen) {
|
1918
1843
|
var i = this.findIndex(pen);
|
1919
|
-
if (i > -1 && i !== this.
|
1920
|
-
this.
|
1921
|
-
this.
|
1844
|
+
if (i > -1 && i !== this.data.pens.length - 1) {
|
1845
|
+
this.data.pens.splice(i + 2, 0, this.data.pens[i]);
|
1846
|
+
this.data.pens.splice(i, 1);
|
1922
1847
|
}
|
1923
1848
|
};
|
1924
1849
|
Topology.prototype.top = function (pen) {
|
1925
1850
|
var i = this.findIndex(pen);
|
1926
1851
|
if (i > -1) {
|
1927
|
-
this.
|
1928
|
-
this.
|
1852
|
+
this.data.pens.push(this.data.pens[i]);
|
1853
|
+
this.data.pens.splice(i, 1);
|
1929
1854
|
}
|
1930
1855
|
};
|
1931
1856
|
Topology.prototype.down = function (pen) {
|
1932
1857
|
var i = this.findIndex(pen);
|
1933
1858
|
if (i > -1 && i !== 0) {
|
1934
|
-
this.
|
1935
|
-
this.
|
1859
|
+
this.data.pens.splice(i - 1, 0, this.data.pens[i]);
|
1860
|
+
this.data.pens.splice(i + 1, 1);
|
1936
1861
|
}
|
1937
1862
|
};
|
1938
1863
|
Topology.prototype.bottom = function (pen) {
|
1939
1864
|
var i = this.findIndex(pen);
|
1940
1865
|
if (i > -1) {
|
1941
|
-
this.
|
1942
|
-
this.
|
1866
|
+
this.data.pens.unshift(this.data.pens[i]);
|
1867
|
+
this.data.pens.splice(i + 1, 1);
|
1943
1868
|
}
|
1944
1869
|
};
|
1945
|
-
Topology.prototype.combine = function (pens, stand, temp
|
1870
|
+
Topology.prototype.combine = function (pens, stand, temp) {
|
1946
1871
|
if (stand === void 0) {
|
1947
1872
|
stand = false;
|
1948
1873
|
}
|
@@ -1955,7 +1880,7 @@ var Topology = (function (_super) {
|
|
1955
1880
|
var item = pens_3[_i];
|
1956
1881
|
var i = this.findIndex(item);
|
1957
1882
|
if (i > -1) {
|
1958
|
-
this.
|
1883
|
+
this.data.pens.splice(i, 1);
|
1959
1884
|
}
|
1960
1885
|
}
|
1961
1886
|
var node = new Node({
|
@@ -1967,8 +1892,6 @@ var Topology = (function (_super) {
|
|
1967
1892
|
paddingTop: 0,
|
1968
1893
|
paddingBottom: 0,
|
1969
1894
|
strokeStyle: 'transparent',
|
1970
|
-
visible: true,
|
1971
|
-
visibleSwitch: true,
|
1972
1895
|
children: [],
|
1973
1896
|
});
|
1974
1897
|
if (temp) {
|
@@ -1979,14 +1902,10 @@ var Topology = (function (_super) {
|
|
1979
1902
|
item.stand = stand;
|
1980
1903
|
item.parentId = node.id;
|
1981
1904
|
item.animatePlay = false;
|
1982
|
-
item.visible = true;
|
1983
|
-
item.visibleSwitch = true;
|
1984
1905
|
item.calcRectInParent(node);
|
1985
|
-
this.deleteSelectTabOptionNode(item);
|
1986
1906
|
node.children.push(item);
|
1987
1907
|
}
|
1988
|
-
|
1989
|
-
this.store.data.pens.push(node);
|
1908
|
+
this.data.pens.push(node);
|
1990
1909
|
this.activeLayer.setPens([node]);
|
1991
1910
|
this.dispatch('node', node);
|
1992
1911
|
this.cache();
|
@@ -1999,57 +1918,27 @@ var Topology = (function (_super) {
|
|
1999
1918
|
return;
|
2000
1919
|
}
|
2001
1920
|
const nodeChildren = JSON.parse(JSON.stringify(node));
|
2002
|
-
var i = this.findIndex(nodeChildren);
|
2003
|
-
if (i > -1 && nodeChildren.name === 'combine') {
|
2004
|
-
this.store.data.pens.splice(i, 1);
|
2005
|
-
} else {
|
2006
|
-
nodeChildren.children = null;
|
2007
|
-
}
|
2008
1921
|
for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
|
2009
1922
|
var item = new Node(_a[_i]);
|
2010
1923
|
item.parentId = undefined;
|
2011
1924
|
item.rectInParent = undefined;
|
2012
1925
|
item.locked = Lock.None;
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
1926
|
+
this.data.pens.push(item);
|
1927
|
+
}
|
1928
|
+
var i = this.findIndex(nodeChildren);
|
1929
|
+
if (i > -1 && nodeChildren.name === 'combine') {
|
1930
|
+
this.data.pens.splice(i, 1);
|
1931
|
+
} else {
|
1932
|
+
nodeChildren.children = null;
|
2016
1933
|
}
|
2017
|
-
this.deleteSelectTabOptionNode(nodeChildren);
|
2018
1934
|
this.cache();
|
2019
1935
|
this.activeLayer.clear();
|
2020
1936
|
this.hoverLayer.clear();
|
2021
1937
|
};
|
2022
|
-
Topology.prototype.deleteSelectTabOptionNode = function (node) {
|
2023
|
-
const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
|
2024
|
-
if(tagNode){
|
2025
|
-
// 删除下拉节点关联的这个元件
|
2026
|
-
const tagArr = tagNode.split('-');
|
2027
|
-
const parentId = tagArr[1] && tagArr[1].trim();
|
2028
|
-
if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
|
2029
|
-
}
|
2030
|
-
},
|
2031
|
-
Topology.prototype.addSelectTabOptionNode = function (node) {
|
2032
|
-
const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
|
2033
|
-
if(tagNode){
|
2034
|
-
// 添加下拉节点关联的这个元件
|
2035
|
-
const tagArr = tagNode.split('-');
|
2036
|
-
const parentId = tagArr[1] && tagArr[1].trim();
|
2037
|
-
if(!parentId) return;
|
2038
|
-
const params = {
|
2039
|
-
TID: node.TID,
|
2040
|
-
id: node.id,
|
2041
|
-
name: node.name,
|
2042
|
-
order: node.order,
|
2043
|
-
visible: node.visible,
|
2044
|
-
tag: tagNode
|
2045
|
-
}
|
2046
|
-
this.store.selectTabDataPool[parentId].set(node.id, params);
|
2047
|
-
}
|
2048
|
-
},
|
2049
1938
|
Topology.prototype.find = function (idOrTag, pens) {
|
2050
1939
|
var _this = this;
|
2051
1940
|
if (!pens) {
|
2052
|
-
pens = this.
|
1941
|
+
pens = this.data.pens;
|
2053
1942
|
}
|
2054
1943
|
var result = [];
|
2055
1944
|
pens.forEach(function (item) {
|
@@ -2066,28 +1955,28 @@ var Topology = (function (_super) {
|
|
2066
1955
|
return result;
|
2067
1956
|
};
|
2068
1957
|
Topology.prototype.findIndex = function (pen) {
|
2069
|
-
for (var i = 0; i < this.
|
2070
|
-
if (pen.id === this.
|
1958
|
+
for (var i = 0; i < this.data.pens.length; ++i) {
|
1959
|
+
if (pen.id === this.data.pens[i].id) {
|
2071
1960
|
return i;
|
2072
1961
|
}
|
2073
1962
|
}
|
2074
1963
|
return -1;
|
2075
1964
|
};
|
2076
1965
|
Topology.prototype.anchor = function (anchor) {
|
2077
|
-
this.
|
1966
|
+
this.options.hideAnchor = anchor
|
2078
1967
|
this.dispatch('hideAnchor', anchor);
|
2079
1968
|
};
|
2080
1969
|
// scale for scaled canvas:
|
2081
1970
|
// > 1, expand
|
2082
1971
|
// < 1, reduce
|
2083
1972
|
Topology.prototype.scale = function (scale, center, w, h) {
|
2084
|
-
if (this.
|
2085
|
-
this.
|
1973
|
+
if (this.data.scale * scale < this.options.minScale ||
|
1974
|
+
this.data.scale * scale > this.options.maxScale) {
|
2086
1975
|
return;
|
2087
1976
|
}
|
2088
|
-
this.
|
1977
|
+
this.data.scale *= scale;
|
2089
1978
|
!center && (center = this.getRect().center);
|
2090
|
-
for (var _i = 0, _a = this.
|
1979
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
2091
1980
|
var item = _a[_i];
|
2092
1981
|
item.scale(scale, center, w, h);
|
2093
1982
|
}
|
@@ -2096,18 +1985,18 @@ var Topology = (function (_super) {
|
|
2096
1985
|
pen.scale(scale, center);
|
2097
1986
|
}
|
2098
1987
|
});
|
2099
|
-
Store.set(this.generateStoreKey('LT:scale'), this.
|
1988
|
+
Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
|
2100
1989
|
this.render();
|
2101
1990
|
this.cache();
|
2102
|
-
this.dispatch('scale', this.
|
1991
|
+
this.dispatch('scale', this.data.scale);
|
2103
1992
|
};
|
2104
1993
|
// scale for origin canvas:
|
2105
1994
|
Topology.prototype.scaleTo = function (scale) {
|
2106
|
-
this.scale(scale / this.
|
2107
|
-
this.
|
1995
|
+
this.scale(scale / this.data.scale);
|
1996
|
+
this.data.scale = scale;
|
2108
1997
|
};
|
2109
1998
|
Topology.prototype.round = function () {
|
2110
|
-
for (var _i = 0, _a = this.
|
1999
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
2111
2000
|
var item = _a[_i];
|
2112
2001
|
if (item instanceof Node) {
|
2113
2002
|
item.round();
|
@@ -2118,7 +2007,7 @@ var Topology = (function (_super) {
|
|
2118
2007
|
if (!this.hasView())
|
2119
2008
|
return;
|
2120
2009
|
// 1. 重置画布尺寸为容器尺寸
|
2121
|
-
var parentElem = this.
|
2010
|
+
var parentElem = this.canvas.parentElem;
|
2122
2011
|
var width = parentElem.offsetWidth, height = parentElem.offsetHeight;
|
2123
2012
|
this.resize({
|
2124
2013
|
width: width,
|
@@ -2127,7 +2016,7 @@ var Topology = (function (_super) {
|
|
2127
2016
|
// 2. 图形居中
|
2128
2017
|
this.centerView(viewPadding);
|
2129
2018
|
// 3. 获取设置的留白值
|
2130
|
-
var padding = formatPadding(viewPadding || this.
|
2019
|
+
var padding = formatPadding(viewPadding || this.options.viewPadding);
|
2131
2020
|
// 4. 获取图形尺寸
|
2132
2021
|
var rect = this.getRect();
|
2133
2022
|
// 6. 计算缩放比
|
@@ -2140,7 +2029,7 @@ var Topology = (function (_super) {
|
|
2140
2029
|
this.scale(ratio);
|
2141
2030
|
};
|
2142
2031
|
Topology.prototype.showTipText = function (data, pos) {
|
2143
|
-
if (this.
|
2032
|
+
if (this.data.locked && data.title) {
|
2144
2033
|
this.divLayer.canvas.title = data.title;
|
2145
2034
|
this.tip = data.id;
|
2146
2035
|
}
|
@@ -2151,15 +2040,15 @@ var Topology = (function (_super) {
|
|
2151
2040
|
return;
|
2152
2041
|
}
|
2153
2042
|
this.scrolling = true;
|
2154
|
-
this.
|
2155
|
-
this.
|
2043
|
+
this.parentElem.scrollLeft += x;
|
2044
|
+
this.parentElem.scrollTop += y;
|
2156
2045
|
setTimeout(function () {
|
2157
2046
|
_this.scrolling = false;
|
2158
2047
|
}, 700);
|
2159
2048
|
};
|
2160
2049
|
Topology.prototype.toComponent = function (pens) {
|
2161
2050
|
if (!pens) {
|
2162
|
-
pens = this.
|
2051
|
+
pens = this.data.pens;
|
2163
2052
|
}
|
2164
2053
|
var rect = this.getRect(pens);
|
2165
2054
|
var node = new Node({
|
@@ -2200,7 +2089,7 @@ var Topology = (function (_super) {
|
|
2200
2089
|
attr = 'text';
|
2201
2090
|
}
|
2202
2091
|
var pen;
|
2203
|
-
this.
|
2092
|
+
this.data.pens.forEach(function (item) {
|
2204
2093
|
if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
|
2205
2094
|
pen = item;
|
2206
2095
|
}
|
@@ -2212,7 +2101,7 @@ var Topology = (function (_super) {
|
|
2212
2101
|
attr = 'text';
|
2213
2102
|
}
|
2214
2103
|
var pen;
|
2215
|
-
this.
|
2104
|
+
this.data.pens.forEach(function (item) {
|
2216
2105
|
if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
|
2217
2106
|
pen = item;
|
2218
2107
|
}
|
@@ -2225,12 +2114,11 @@ var Topology = (function (_super) {
|
|
2225
2114
|
this.gridElem.style.left = '0';
|
2226
2115
|
this.gridElem.style.top = '0';
|
2227
2116
|
this.gridElem.innerHTML = "<svg class=\"svg-grid\" width=\"100%\" height=\"100%\" style=\"position:absolute;left:0;right:0;top:0;bottom:0\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <pattern id=\"grid\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 10 0 L 0 0 0 10\" fill=\"none\" stroke=\"#f3f3f3\" stroke-width=\"1\" />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n </svg>";
|
2228
|
-
this.
|
2117
|
+
this.parentElem.appendChild(this.gridElem);
|
2229
2118
|
};
|
2230
2119
|
Topology.prototype.showGrid = function (show) {
|
2231
|
-
if(!this.store || !this.store.data) return;
|
2232
2120
|
if (show === undefined) {
|
2233
|
-
show = this.
|
2121
|
+
show = this.data.grid;
|
2234
2122
|
}
|
2235
2123
|
this.gridElem.style.width = this.canvas.width + 'px';
|
2236
2124
|
this.gridElem.style.height = this.canvas.height + 'px';
|
@@ -2321,7 +2209,7 @@ var Topology = (function (_super) {
|
|
2321
2209
|
canvas.style.height = 500 + 'px';
|
2322
2210
|
canvas.style.zIndex = 1;
|
2323
2211
|
canvas.setAttribute('id', 'arbitraryCanvas');
|
2324
|
-
this.
|
2212
|
+
this.parentElem.appendChild(canvas)
|
2325
2213
|
};
|
2326
2214
|
Topology.prototype.createArbitraryGraph = function () {
|
2327
2215
|
|
@@ -2378,31 +2266,6 @@ var Topology = (function (_super) {
|
|
2378
2266
|
|
2379
2267
|
return true
|
2380
2268
|
};
|
2381
|
-
Topology.prototype.formOverflowOpen = function (data) {
|
2382
|
-
this.formOverflowConversionData(data);
|
2383
|
-
this.overflowView();
|
2384
|
-
this.render(true);
|
2385
|
-
}
|
2386
|
-
Topology.prototype.overflowView = function (data) {
|
2387
|
-
try {
|
2388
|
-
var rect = this.getRect();
|
2389
|
-
let _a = this.canvas;
|
2390
|
-
if(!_a.width) return;
|
2391
|
-
let width = _a.width, height = _a.height;
|
2392
|
-
let rectWidth = rect.width? (rect.ex + 4) : rect.width
|
2393
|
-
let rectHeight= rect.height? (rect.ey + 4) : rect.height
|
2394
|
-
if (width < rectWidth) {
|
2395
|
-
width = rectWidth;
|
2396
|
-
}
|
2397
|
-
if (height < rectHeight) {
|
2398
|
-
height = rectHeight;
|
2399
|
-
}
|
2400
|
-
this.resize({width: width, height: height});
|
2401
|
-
return rect;
|
2402
|
-
}catch (e){
|
2403
|
-
console.log('-error--------overflowView---',e)
|
2404
|
-
}
|
2405
|
-
}
|
2406
2269
|
return Topology;
|
2407
2270
|
}(Common));
|
2408
2271
|
|