dcim-topology2d 1.1.3 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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/src/echarts/index.d.ts +1 -1
- package/chart-diagram/src/echarts/index.js +7 -10
- package/chart-diagram/src/register.js +1 -1
- 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 -1
- package/core/index.js +0 -1
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +41 -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 -40
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +18 -17
- package/core/src/common.d.ts +5 -5
- package/core/src/common.js +115 -161
- package/core/src/core.d.ts +4 -3
- package/core/src/core.js +253 -228
- package/core/src/divLayer.d.ts +7 -2
- package/core/src/divLayer.js +25 -25
- package/core/src/healps/changeData.d.ts +1 -1
- package/core/src/healps/changeData.js +42 -77
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- 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.js +12 -14
- package/core/src/models/pen.js +1 -10
- 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.js +0 -1
- package/core/src/poll.js +2 -0
- package/core/src/preview.d.ts +13 -1
- package/core/src/preview.js +34 -42
- package/core/src/renderLayer.d.ts +3 -1
- package/core/src/renderLayer.js +31 -26
- 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/conversion.d.ts +0 -7
- package/core/src/utils/conversion.js +0 -54
- package/core/src/utils/dom.d.ts +5 -4
- package/core/src/utils/dom.js +1 -3
- package/core/src/utils/onmousevent.js +3 -12
- 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/myShape.js +1 -1
- 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/core/src/store/common.d.ts +0 -9
- package/core/src/store/common.js +0 -5
- package/core/src/store/data.d.ts +0 -126
- package/core/src/store/data.js +0 -80
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/static/echartsDefaultData.js +0 -95
- package/static/index.js +0 -1
- package/style/index.css +0 -10
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function activityFinal(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function forkHAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.ex, node.rect.y + node.rect.height / 2, Direction.Right));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function fork(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { registerNode } from '
|
1
|
+
import { registerNode } from 'dcim-topology/core';
|
2
2
|
import { activityFinal, activityFinalIconRect, activityFinalTextRect } from './final';
|
3
3
|
import { fork, forkHAnchors, forkVAnchors, forkIconRect, forkTextRect } from './fork';
|
4
4
|
import { swimlaneH, swimlaneHIconRect, swimlaneHTextRect } from './swimlaneH';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function swimlaneH(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function swimlaneV(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { s8, createDiv, rectangle } from '
|
1
|
+
import { s8, createDiv, rectangle } from 'dcim-topology/core';
|
2
2
|
export let echartsData = {};
|
3
3
|
export function echarts(ctx, node) {
|
4
4
|
//console.log('echarts绘制-----node', node);
|
@@ -62,12 +62,6 @@ export function echarts(ctx, node) {
|
|
62
62
|
return '';
|
63
63
|
}
|
64
64
|
}
|
65
|
-
if(option.series.length < 2) {
|
66
|
-
option.tooltip.formatter = function(params) {
|
67
|
-
const item = params[0];
|
68
|
-
return item.name + ' : ' + item.value;
|
69
|
-
}
|
70
|
-
}
|
71
65
|
// if(option.series.length >= 2) {
|
72
66
|
|
73
67
|
// for(let i=0; i<option.series.length-1 ; i++){
|
@@ -78,14 +72,17 @@ export function echarts(ctx, node) {
|
|
78
72
|
option.yAxis[0].splitLine = node.appearance.splitLine;
|
79
73
|
|
80
74
|
}else if(node.appearance.type === 'gauge') {
|
75
|
+
const pointerColor = node.appearance.pointerColor;
|
76
|
+
node.appearance.pointer.length = `${node.appearance.pointer.length}%`;
|
81
77
|
option.series[0].min = node.appearance.min;
|
82
78
|
option.series[0].max = node.appearance.max;
|
79
|
+
option.series[0].itemStyle.color = pointerColor ? pointerColor : node.appearance.axisLabel.color;
|
83
80
|
option.series[0].splitNumber = node.appearance.splitNumber;
|
84
81
|
option.series[0].pointer = node.appearance.pointer;
|
85
82
|
option.series[0].axisLabel = node.appearance.axisLabel;
|
86
83
|
option.series[0].axisLine.lineStyle = node.appearance.axisLine.lineStyle;
|
87
|
-
|
88
|
-
|
84
|
+
option.series[0].detail = node.appearance.detail;
|
85
|
+
//option.series[0].data = node.appearance.data;
|
89
86
|
if(option.isGaugeLinear) {
|
90
87
|
option.series[0].axisLine.lineStyle.color = [
|
91
88
|
[1, new echarts.graphic.LinearGradient(0, 0, 1, 0, option.linearColors)]
|
@@ -97,7 +94,7 @@ export function echarts(ctx, node) {
|
|
97
94
|
}
|
98
95
|
option.title = node.appearance.title;
|
99
96
|
option.backgroundColor = node.appearance.backgroundColor;
|
100
|
-
|
97
|
+
echartsData[node.id].chart.clear();
|
101
98
|
echartsData[node.id].chart.setOption(option);
|
102
99
|
echartsData[node.id].chart.resize();
|
103
100
|
node.elementRendered = true;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function simpleClassIconRect(node: Node): void;
|
3
3
|
export declare function simpleClassTextRect(node: Node): void;
|
4
4
|
export declare function interfaceClassIconRect(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { registerNode } from '
|
1
|
+
import { registerNode } from 'dcim-topology/core';
|
2
2
|
import { simpleClass, simpleClassIconRect, simpleClassTextRect, interfaceClass, interfaceClassIconRect, interfaceClassTextRect } from './class';
|
3
3
|
export function register() {
|
4
4
|
registerNode('simpleClass', simpleClass, null, simpleClassIconRect, simpleClassTextRect);
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
@@ -6,7 +6,6 @@ export * from './src/utils';
|
|
6
6
|
export * from './src/models';
|
7
7
|
export * from './src/middles';
|
8
8
|
export * from './src/healps';
|
9
|
-
export * from './src/store';
|
10
9
|
//# sourceMappingURL=index.js.map
|
11
10
|
import axios from 'axios'
|
12
11
|
if(axios.defaults.headers.common) axios.defaults.headers.common['Authorization'] = getToken();
|
@@ -1,7 +1,15 @@
|
|
1
|
-
import {
|
1
|
+
import { Options } from './options';
|
2
|
+
import { Pen } from './models/pen';
|
3
|
+
import { Node } from './models/node';
|
4
|
+
import { Line } from './models/line';
|
5
|
+
import { Rect } from './models/rect';
|
6
|
+
import { Point } from './models/point';
|
7
|
+
import { TopologyData } from './models/data';
|
2
8
|
import { Layer } from './layer';
|
3
9
|
import { Topology } from './core';
|
4
10
|
export declare class ActiveLayer extends Layer {
|
11
|
+
options: Options;
|
12
|
+
protected data: TopologyData;
|
5
13
|
rotateCPs: Point[];
|
6
14
|
sizeCPs: Point[];
|
7
15
|
rect: Rect;
|
@@ -18,7 +26,7 @@ export declare class ActiveLayer extends Layer {
|
|
18
26
|
dockWatchers: Point[];
|
19
27
|
topology: Topology;
|
20
28
|
rotating: boolean;
|
21
|
-
constructor(TID: String);
|
29
|
+
constructor(options: Options, TID: String);
|
22
30
|
calcControlPoints(): void;
|
23
31
|
locked(): boolean;
|
24
32
|
getPoints(): Point[];
|
package/core/src/activeLayer.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
var __extends = (this && this.__extends) || (function () {
|
2
2
|
var extendStatics = function (d, b) {
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
4
|
-
|
5
|
-
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6
6
|
return extendStatics(d, b);
|
7
7
|
};
|
8
8
|
return function (d, b) {
|
@@ -12,16 +12,22 @@ var __extends = (this && this.__extends) || (function () {
|
|
12
12
|
};
|
13
13
|
})();
|
14
14
|
import { Store } from 'le5le-store';
|
15
|
-
import { PenType
|
15
|
+
import { PenType } from './models/pen';
|
16
|
+
import { Node } from './models/node';
|
17
|
+
import { Line } from './models/line';
|
18
|
+
import { Rect } from './models/rect';
|
19
|
+
import { Point } from './models/point';
|
20
|
+
import { Lock } from './models/status';
|
16
21
|
import { drawLineFns } from './middles';
|
17
22
|
import { getBezierPoint } from './middles/lines/curve';
|
18
23
|
import { Layer } from './layer';
|
19
24
|
import { flatNodes } from './utils';
|
20
|
-
import { commonStore } from './store'
|
21
25
|
var ActiveLayer = /** @class */ (function (_super) {
|
22
26
|
__extends(ActiveLayer, _super);
|
23
|
-
function ActiveLayer(TID) {
|
27
|
+
function ActiveLayer(options, TID) {
|
28
|
+
if (options === void 0) { options = {}; }
|
24
29
|
var _this = _super.call(this, TID) || this;
|
30
|
+
_this.options = options;
|
25
31
|
_this.rotateCPs = [];
|
26
32
|
_this.sizeCPs = [];
|
27
33
|
_this.pens = [];
|
@@ -36,11 +42,11 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
36
42
|
// nodes移动时,停靠点的参考位置
|
37
43
|
_this.dockWatchers = [];
|
38
44
|
_this.rotating = false;
|
45
|
+
_this.data = Store.get(_this.generateStoreKey('topology-data'));
|
39
46
|
Store.set(_this.generateStoreKey('LT:ActiveLayer'), _this);
|
40
47
|
return _this;
|
41
48
|
}
|
42
49
|
ActiveLayer.prototype.calcControlPoints = function () {
|
43
|
-
var globalStore = commonStore[this.TID];
|
44
50
|
if (this.pens.length === 1 && this.pens[0] instanceof Node) {
|
45
51
|
this.rect = this.pens[0].rect;
|
46
52
|
this.sizeCPs = this.pens[0].rect.toPoints();
|
@@ -68,7 +74,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
68
74
|
}
|
69
75
|
}
|
70
76
|
}
|
71
|
-
if (
|
77
|
+
if (this.options.hideRotateCP || this.pens[0].hideRotateCP) {
|
72
78
|
this.rotateCPs = [new Point(-1000, -1000), new Point(-1000, -1000)];
|
73
79
|
}
|
74
80
|
return;
|
@@ -96,10 +102,9 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
96
102
|
this.rect = new Rect(x1, y1, x2 - x1, y2 - y1);
|
97
103
|
this.sizeCPs = [new Point(x1, y1), new Point(x2, y1), new Point(x2, y2), new Point(x1, y2)];
|
98
104
|
this.rotateCPs = [new Point(x1 + (x2 - x1) / 2, y1 - 35), new Point(x1 + (x2 - x1) / 2, y1)];
|
99
|
-
if (
|
105
|
+
if (this.options.hideRotateCP) {
|
100
106
|
this.rotateCPs = [new Point(-1000, -1000), new Point(-1000, -1000)];
|
101
107
|
}
|
102
|
-
globalStore = null;
|
103
108
|
};
|
104
109
|
ActiveLayer.prototype.locked = function () {
|
105
110
|
for (var _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
@@ -187,10 +192,10 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
187
192
|
}
|
188
193
|
var offsetX = p2.x - p1.x;
|
189
194
|
var offsetY = p2.y - p1.y;
|
190
|
-
if (
|
195
|
+
if (this.options.onlySizeX) {
|
191
196
|
offsetY = 0;
|
192
197
|
}
|
193
|
-
if (
|
198
|
+
if (this.options.onlySizeY) {
|
194
199
|
offsetX = 0;
|
195
200
|
}
|
196
201
|
var lines = [];
|
@@ -278,7 +283,6 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
278
283
|
if (this.nodeRects.length !== this.pens.length) {
|
279
284
|
return;
|
280
285
|
}
|
281
|
-
var globalStore = commonStore[this.TID];
|
282
286
|
var i = 0;
|
283
287
|
for (var _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
284
288
|
var item = _a[_i];
|
@@ -297,7 +301,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
297
301
|
item.calcChildrenRect();
|
298
302
|
if (item.parentId && !item.locked) {
|
299
303
|
var parent_1 = void 0;
|
300
|
-
for (var _c = 0, _d =
|
304
|
+
for (var _c = 0, _d = this.data.pens; _c < _d.length; _c++) {
|
301
305
|
var n = _d[_c];
|
302
306
|
if (n.id === item.parentId) {
|
303
307
|
parent_1 = n;
|
@@ -317,7 +321,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
317
321
|
var offsetX_1 = this.nodeRects[i].x + x - item.from.x;
|
318
322
|
var offsetY_1 = this.nodeRects[i].y + y - item.from.y;
|
319
323
|
if (item.parentId) {
|
320
|
-
var items = find(item.parentId,
|
324
|
+
var items = find(item.parentId, this.data.pens);
|
321
325
|
items.forEach(function (l) {
|
322
326
|
l.translate(offsetX_1, offsetY_1);
|
323
327
|
});
|
@@ -334,7 +338,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
334
338
|
ActiveLayer.prototype.getLinesOfNode = function (node) {
|
335
339
|
var result = [];
|
336
340
|
var nodesLines = flatNodes([node]);
|
337
|
-
for (var _i = 0, _a =
|
341
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
338
342
|
var pen = _a[_i];
|
339
343
|
if (!(pen instanceof Line)) {
|
340
344
|
continue;
|
@@ -361,10 +365,9 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
361
365
|
if (!pens) {
|
362
366
|
pens = this.pens;
|
363
367
|
}
|
364
|
-
var globalStore = commonStore[this.TID];
|
365
368
|
var nodesLines = flatNodes(pens);
|
366
369
|
var lines = [];
|
367
|
-
nodesLines.lines.push.apply(nodesLines.lines,
|
370
|
+
nodesLines.lines.push.apply(nodesLines.lines, this.data.pens.filter(function (pen) { return pen.type; }));
|
368
371
|
for (var _i = 0, _a = nodesLines.lines; _i < _a.length; _i++) {
|
369
372
|
var line = _a[_i];
|
370
373
|
for (var _b = 0, _c = nodesLines.nodes; _b < _c.length; _b++) {
|
@@ -380,7 +383,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
380
383
|
line.to.y = item.rotatedAnchors[line.to.anchorIndex].y;
|
381
384
|
++cnt;
|
382
385
|
}
|
383
|
-
if (cnt && !
|
386
|
+
if (cnt && !this.data.manualCps) {
|
384
387
|
line.calcControlPoints();
|
385
388
|
}
|
386
389
|
line.textRect = null;
|
@@ -389,7 +392,6 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
389
392
|
}
|
390
393
|
}
|
391
394
|
Store.set(this.generateStoreKey('LT:updateLines'), lines);
|
392
|
-
globalStore = null;
|
393
395
|
};
|
394
396
|
ActiveLayer.prototype.offsetRotate = function (angle) {
|
395
397
|
this.rotating = true;
|
@@ -490,9 +492,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
490
492
|
};
|
491
493
|
ActiveLayer.prototype.render = function (ctx) {
|
492
494
|
var _this = this;
|
493
|
-
if(
|
494
|
-
var globalStore = commonStore[_this.TID];
|
495
|
-
if (globalStore.data.locked > Lock.Readonly) {
|
495
|
+
if (this.data.locked > Lock.Readonly) {
|
496
496
|
return;
|
497
497
|
}
|
498
498
|
|
@@ -508,7 +508,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
508
508
|
this.calcControlPoints();
|
509
509
|
}
|
510
510
|
ctx.save();
|
511
|
-
ctx.strokeStyle =
|
511
|
+
ctx.strokeStyle = this.options.activeColor;
|
512
512
|
ctx.fillStyle = '#fff';
|
513
513
|
ctx.lineWidth = 1;
|
514
514
|
var TID = this.TID;
|
@@ -528,7 +528,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
528
528
|
tmp.strokeStyle = '#ffffff';
|
529
529
|
tmp.lineWidth += 2;
|
530
530
|
tmp.render(ctx);
|
531
|
-
tmp.strokeStyle =
|
531
|
+
tmp.strokeStyle = this.options.activeColor;
|
532
532
|
tmp.lineWidth -= 2;
|
533
533
|
}
|
534
534
|
}
|
@@ -543,11 +543,11 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
543
543
|
bk.strokeStyle = '#ffffff';
|
544
544
|
bk.render(ctx);
|
545
545
|
}
|
546
|
-
tmp.strokeStyle =
|
547
|
-
tmp.fromArrowColor =
|
548
|
-
tmp.toArrowColor =
|
546
|
+
tmp.strokeStyle = this.options.activeColor;
|
547
|
+
tmp.fromArrowColor = this.options.activeColor;
|
548
|
+
tmp.toArrowColor = this.options.activeColor;
|
549
549
|
tmp.render(ctx);
|
550
|
-
if (!
|
550
|
+
if (!this.data.locked && !item.locked) {
|
551
551
|
drawLineFns[item.name].drawControlPointsFn(ctx, item);
|
552
552
|
}
|
553
553
|
}
|
@@ -573,7 +573,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
573
573
|
ctx.closePath();
|
574
574
|
ctx.stroke();
|
575
575
|
ctx.restore();
|
576
|
-
if (
|
576
|
+
if (this.data.locked || this.locked()) {
|
577
577
|
ctx.restore();
|
578
578
|
return;
|
579
579
|
}
|
@@ -589,7 +589,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
589
589
|
ctx.fill();
|
590
590
|
ctx.stroke();
|
591
591
|
// Draw size control points.绘制拖拽框四角的点
|
592
|
-
if (!
|
592
|
+
if (!this.options.hideSizeCP && (this.pens.length > 1 || !this.pens[0].hideSizeCP)) {
|
593
593
|
ctx.lineWidth = 1;
|
594
594
|
for (var _b = 0, _c = this.sizeCPs; _b < _c.length; _b++) {
|
595
595
|
var item = _c[_b];
|
@@ -606,7 +606,6 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
606
606
|
}
|
607
607
|
}
|
608
608
|
ctx.restore();
|
609
|
-
globalStore = null;
|
610
609
|
};
|
611
610
|
ActiveLayer.prototype.getDockWatchers = function () {
|
612
611
|
if (this.pens.length === 1) {
|
@@ -623,7 +622,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
623
622
|
ActiveLayer.prototype.handleArbitrayGraphSize = function (type,item, offsetX, offsetY, l, sizeX, sizeY, nodeRectsCircles) {
|
624
623
|
if(item.name !== 'arbitraryGraph') return
|
625
624
|
|
626
|
-
|
625
|
+
switch (type) {
|
627
626
|
|
628
627
|
case 0:
|
629
628
|
|
@@ -635,7 +634,7 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
635
634
|
|
636
635
|
}
|
637
636
|
|
638
|
-
|
637
|
+
break;
|
639
638
|
|
640
639
|
case 1:
|
641
640
|
|
@@ -647,19 +646,19 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
647
646
|
|
648
647
|
}
|
649
648
|
|
650
|
-
|
649
|
+
break;
|
651
650
|
|
652
651
|
case 2:
|
653
652
|
|
654
|
-
|
655
|
-
|
656
|
-
item.rect.circles[c].x=item.rect.circles[c].x*sizeX+item.rect.x*(1-sizeX);
|
653
|
+
for(let c=0, length = item.rect.circles.length; c<length; c++ ) {
|
657
654
|
|
658
|
-
|
655
|
+
item.rect.circles[c].x=item.rect.circles[c].x*sizeX+item.rect.x*(1-sizeX);
|
656
|
+
|
657
|
+
item.rect.circles[c].y=item.rect.circles[c].y*sizeY+item.rect.y*(1-sizeY);
|
659
658
|
|
660
|
-
|
659
|
+
}
|
661
660
|
|
662
|
-
|
661
|
+
break;
|
663
662
|
|
664
663
|
case 3:
|
665
664
|
|
@@ -671,10 +670,10 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
671
670
|
|
672
671
|
}
|
673
672
|
|
674
|
-
|
673
|
+
break
|
675
674
|
}
|
676
675
|
};
|
677
676
|
return ActiveLayer;
|
678
677
|
}(Layer));
|
679
678
|
export { ActiveLayer };
|
680
|
-
//# sourceMappingURL=activeLayer.js.map
|
679
|
+
//# sourceMappingURL=activeLayer.js.map
|
@@ -1,13 +1,17 @@
|
|
1
|
-
import { Pen
|
1
|
+
import { Pen } from './models/pen';
|
2
|
+
import { Line } from './models/line';
|
3
|
+
import { TopologyData } from './models/data';
|
4
|
+
import { Options } from './options';
|
2
5
|
import { Layer } from './layer';
|
3
6
|
export declare class AnimateLayer extends Layer {
|
4
|
-
|
7
|
+
options: Options;
|
8
|
+
protected data: TopologyData;
|
5
9
|
pens: Map<any, any>;
|
6
10
|
private timer;
|
7
11
|
private lastNow;
|
8
12
|
private subscribeUpdate;
|
9
13
|
private subscribePlay;
|
10
|
-
constructor(TID: String);
|
14
|
+
constructor(options: Options, TID: String);
|
11
15
|
getAnimateLine(item: Pen): Line;
|
12
16
|
findLine(pen: Pen): Pen;
|
13
17
|
readyPlay(tag?: string, auto?: boolean, pens?: Pen[]): void;
|
package/core/src/animateLayer.js
CHANGED
@@ -12,19 +12,23 @@ var __extends = (this && this.__extends) || (function () {
|
|
12
12
|
};
|
13
13
|
})();
|
14
14
|
import { Store } from 'le5le-store';
|
15
|
-
import { PenType
|
15
|
+
import { PenType } from './models/pen';
|
16
|
+
import { Node } from './models/node';
|
17
|
+
import { Line } from './models/line';
|
16
18
|
import { Layer } from './layer';
|
17
19
|
import { s8 } from './utils';
|
18
|
-
import { commonStore } from './store'
|
19
20
|
var AnimateLayer = /** @class */ (function (_super) {
|
20
21
|
__extends(AnimateLayer, _super);
|
21
|
-
function AnimateLayer(TID) {
|
22
|
+
function AnimateLayer(options, TID) {
|
23
|
+
if (options === void 0) { options = {}; }
|
22
24
|
var _this = _super.call(this, TID) || this;
|
25
|
+
_this.options = options;
|
23
26
|
_this.pens = new Map();
|
24
27
|
_this.lastNow = 0;
|
28
|
+
_this.data = Store.get(_this.generateStoreKey('topology-data'));
|
25
29
|
Store.set(_this.generateStoreKey('LT:AnimateLayer'), _this);
|
26
|
-
if (!
|
27
|
-
|
30
|
+
if (!_this.options.animateColor) {
|
31
|
+
_this.options.animateColor = '#ff6600';
|
28
32
|
}
|
29
33
|
_this.subscribeUpdate = Store.subscribe(_this.generateStoreKey('LT:updateLines'), function (lines) {
|
30
34
|
_this.updateLines(lines);
|
@@ -51,7 +55,7 @@ var AnimateLayer = /** @class */ (function (_super) {
|
|
51
55
|
l.animateStart = item.animateStart;
|
52
56
|
l.lineCap = 'round';
|
53
57
|
l.fillStyle = '#fff';
|
54
|
-
l.strokeStyle = l.animateColor ||
|
58
|
+
l.strokeStyle = l.animateColor || this.options.animateColor;
|
55
59
|
l.length = l.getLen();
|
56
60
|
if (!l.fromArrowColor) {
|
57
61
|
l.fromArrowColor = l.strokeStyle || '#222';
|
@@ -62,7 +66,7 @@ var AnimateLayer = /** @class */ (function (_super) {
|
|
62
66
|
return l;
|
63
67
|
};
|
64
68
|
AnimateLayer.prototype.findLine = function (pen) {
|
65
|
-
for (var _i = 0, _a =
|
69
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
66
70
|
var item = _a[_i];
|
67
71
|
if (item.id === pen.data) {
|
68
72
|
return item;
|
@@ -71,13 +75,11 @@ var AnimateLayer = /** @class */ (function (_super) {
|
|
71
75
|
};
|
72
76
|
AnimateLayer.prototype.readyPlay = function (tag, auto, pens) {
|
73
77
|
var _this = this;
|
74
|
-
if(!commonStore || !commonStore[_this.TID]) return;
|
75
78
|
var readyPens = new Map();
|
76
79
|
if (!pens) {
|
77
|
-
pens =
|
80
|
+
pens = this.data.pens;
|
78
81
|
}
|
79
82
|
pens.forEach(function (pen) {
|
80
|
-
if(!(pen instanceof Node)) pen = new Node(pen);
|
81
83
|
pen.setTID(_this.TID);
|
82
84
|
if (!pen.visible || readyPens.get(pen.id)) {
|
83
85
|
return;
|
package/core/src/calling.d.ts
CHANGED
@@ -2,9 +2,12 @@
|
|
2
2
|
import {Options, Padding} from './options';
|
3
3
|
import { Offscreen } from './offscreen';
|
4
4
|
import { RenderLayer } from './renderLayer';
|
5
|
-
import { Pen, Point, Rect } from './models';
|
5
|
+
import { Pen, Node, Point, TopologyData, Rect } from './models';
|
6
6
|
export declare class Calling {
|
7
7
|
id: String;
|
8
|
+
data: TopologyData;
|
9
|
+
options: Options;
|
10
|
+
parentElem: HTMLElement;
|
8
11
|
canvas: RenderLayer;
|
9
12
|
offscreen: Offscreen;
|
10
13
|
private subcribeImage;
|