dcim-topology2d 1.1.6 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/chart-diagram/index.d.ts +1 -1
  2. package/chart-diagram/index.js +1 -1
  3. package/chart-diagram/src/echarts/index.js +88 -96
  4. package/chart-diagram/src/register.js +3 -3
  5. package/chart-diagram/src/utils/changeOptions.d.ts +7 -4
  6. package/chart-diagram/src/utils/changeOptions.js +228 -144
  7. package/chart-diagram/src/utils/conversion.d.ts +12 -12
  8. package/chart-diagram/src/utils/conversion.js +263 -137
  9. package/chart-diagram/src/utils/render.d.ts +6 -0
  10. package/chart-diagram/src/utils/render.js +124 -0
  11. package/core/index.d.ts +1 -0
  12. package/core/index.js +1 -0
  13. package/core/src/activeLayer.js +0 -6
  14. package/core/src/canvas.js +1 -0
  15. package/core/src/common.d.ts +1 -2
  16. package/core/src/common.js +197 -541
  17. package/core/src/core.js +116 -60
  18. package/core/src/divLayer.d.ts +0 -3
  19. package/core/src/divLayer.js +13 -34
  20. package/core/src/element/common.d.ts +5 -0
  21. package/core/src/element/common.js +52 -0
  22. package/core/src/element/iframe.d.ts +3 -0
  23. package/core/src/element/iframe.js +12 -0
  24. package/core/src/element/index.d.ts +4 -0
  25. package/core/src/element/index.js +4 -0
  26. package/core/src/element/select.d.ts +11 -0
  27. package/core/src/element/select.js +234 -0
  28. package/core/src/element/tab.d.ts +1 -0
  29. package/core/src/element/tab.js +19 -0
  30. package/core/src/healps/changeData.d.ts +1 -2
  31. package/core/src/healps/changeData.js +33 -125
  32. package/core/src/middles/default.js +3 -1
  33. package/core/src/middles/nodes/arbitrarygraph.js +11 -9
  34. package/core/src/middles/nodes/formselect.d.ts +2 -0
  35. package/core/src/middles/nodes/formselect.js +87 -0
  36. package/core/src/middles/nodes/iframe.js +21 -4
  37. package/core/src/middles/nodes/index.d.ts +1 -0
  38. package/core/src/middles/nodes/index.js +1 -0
  39. package/core/src/models/node.d.ts +4 -0
  40. package/core/src/models/node.js +24 -22
  41. package/core/src/models/pen.js +3 -52
  42. package/core/src/models/rect.js +2 -2
  43. package/core/src/options.d.ts +2 -0
  44. package/core/src/options.js +2 -1
  45. package/core/src/preview.js +51 -32
  46. package/core/src/renderLayer.d.ts +10 -6
  47. package/core/src/renderLayer.js +36 -43
  48. package/core/src/store/data.d.ts +71 -21
  49. package/core/src/store/data.js +93 -17
  50. package/core/src/utils/assignment.d.ts +6 -3
  51. package/core/src/utils/assignment.js +120 -21
  52. package/core/src/utils/construction.d.ts +10 -3
  53. package/core/src/utils/construction.js +7 -1
  54. package/core/src/utils/conversion.d.ts +3 -0
  55. package/core/src/utils/conversion.js +62 -1
  56. package/core/src/utils/index.d.ts +1 -1
  57. package/core/src/utils/index.js +1 -1
  58. package/core/src/utils/math.d.ts +1 -0
  59. package/core/src/utils/math.js +3 -0
  60. package/core/src/utils/onmousevent.d.ts +3 -0
  61. package/core/src/utils/onmousevent.js +27 -7
  62. package/core/src/utils/params.d.ts +2 -0
  63. package/core/src/utils/params.js +57 -0
  64. package/myShape-diagram/index.js +196 -0
  65. package/package.json +1 -1
  66. package/static/echartsDefaultData.js +27 -107
  67. package/static/element.js +14 -0
  68. package/static/form.js +11 -0
  69. package/static/index.js +2 -1
  70. package/store/actions.js +1 -0
  71. package/store/clear.js +10 -0
  72. package/store/index.js +2 -0
  73. package/style/common.css +18 -0
  74. package/style/editor.css +13 -0
  75. package/style/index.css +3 -12
  76. package/style/select.css +143 -0
  77. package/core/src/poll.js +0 -37
  78. package/core/src/utils/dom.d.ts +0 -9
  79. package/core/src/utils/dom.js +0 -103
  80. package/core/src/utils/dom.js.map +0 -1
  81. package/myShape-diagram/myShape.js +0 -196
  82. package/static/echartsStore.js +0 -14
  83. /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
@@ -0,0 +1,143 @@
1
+ .topology-select {
2
+ width: 160px;
3
+ height: 30px;
4
+ display: flex;
5
+ position: relative;
6
+ background-size: 100%;
7
+ }
8
+ .topology-select .topology-select-remove{
9
+ display: none;
10
+ position: absolute;
11
+ top: 50%;
12
+ right: 10px;
13
+ width: 13px;
14
+ height: 13px;
15
+ line-height: 8px;
16
+ font-size: 10px;
17
+ color: #c0c4cc;
18
+ cursor: pointer;
19
+ text-align: center;
20
+ border: 1px solid #c0c4cc;
21
+ border-radius: 100%;
22
+ transform: translateY(-50%);
23
+ }
24
+ .topology-select .topology-select-icon-arrow{
25
+ display: block;
26
+ position: absolute;
27
+ top: 50%;
28
+ right: 10px;
29
+ width: 0;
30
+ height: 0;
31
+ border: 7px solid transparent;
32
+ border-top-color: #284689;
33
+ border-bottom-width: 0;
34
+ border-top-left-radius: 4px;
35
+ border-top-right-radius: 4px;
36
+ transform: translateY(-50%);
37
+ transition: all .3s;
38
+ }
39
+ .topology-select .topology-select-icon-arrow.reverse{
40
+ /* top: 39%; */
41
+ transform: translateY(-50%) rotate(180deg);
42
+ }
43
+ .topology-select input {
44
+ width: 100%;
45
+ height: 100%;
46
+ font-size: 14px;
47
+ padding: 0 10px;
48
+ border-radius: 4px;
49
+ border: 1px solid #284689;
50
+ background: transparent;
51
+ outline: none;
52
+ cursor: pointer;
53
+ color: #fff;
54
+ }
55
+ .topology-select-dropdown {
56
+ position: absolute;
57
+ width: 160px;
58
+ border-radius: 5px;
59
+ margin-top: 14px;
60
+ border: 1px solid #284689;
61
+ background-size: 100%;
62
+ background-color: #0b1531;
63
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
64
+ display: none;
65
+ }
66
+ .topology-select-dropdown .popper__arrow{
67
+ display: block;
68
+ position: absolute;
69
+ top: -7px;
70
+ left: 20%;
71
+ width: 0;
72
+ height: 0;
73
+ border: 6px solid transparent;
74
+ border-bottom-color: #284689;
75
+ border-top-width: 0;
76
+ }
77
+ /* 隐藏滚动条 */
78
+ .topology-select-dropdown-list::-webkit-scrollbar {
79
+ display: none;
80
+ }
81
+ .topology-select-dropdown .topology-select-dropdown-list {
82
+ max-height: 230px;
83
+ margin: 8px 0;
84
+ overflow: auto;
85
+ background-size: 100%;
86
+ }
87
+ .topology-select-dropdown .topology-select-dropdown-list li {
88
+ display: flex;
89
+ height: 30px;
90
+ line-height: 30px;
91
+ align-items: center;
92
+ color: #fff;
93
+ cursor: pointer;
94
+ font-size: 12px;
95
+ }
96
+ .topology-select-dropdown .topology-select-dropdown-list li:hover {
97
+ background-color: #265797;
98
+ color: #fff !important;
99
+ }
100
+ .topology-select-dropdown .topology-select-dropdown-list li.selected {
101
+ color: #409eff !important;
102
+ font-weight: 700;
103
+ }
104
+ .topology-select-dropdown .topology-select-dropdown-list li span {
105
+ display: block;
106
+ width: 100%;
107
+ height: 100%;
108
+ padding: 0 20px;
109
+ cursor: pointer;
110
+ }
111
+ .topology-select.theme1 input{
112
+ padding: 0 35px 0 20px;
113
+ border-color: rgb(56, 255, 255);
114
+ background-color: rgba(56, 255, 255, 0.2);
115
+ font-size: 14px;
116
+ font-weight: 400;
117
+ font-family: "Arial Black";
118
+ }
119
+ .topology-select.theme1 .topology-select-icon-arrow{
120
+ border-top-color: rgb(56, 255, 255);
121
+ }
122
+ .topology-select-dropdown.theme1{
123
+ margin-top: 3px;
124
+ padding: 5px 0;
125
+ border-color: rgb(56, 255, 255);
126
+ background-color: rgb(9, 57, 75);
127
+ }
128
+ .topology-select-dropdown.theme1 .topology-select-dropdown-list{
129
+ margin: 0;
130
+ }
131
+ .topology-select-dropdown.theme1 .topology-select-dropdown-list li {
132
+ font-size: 14px;
133
+ }
134
+ .topology-select-dropdown.theme1 .topology-select-dropdown-list li:hover {
135
+ background-color: rgba(56, 255, 255, 0.2);
136
+ color: rgb(56, 255, 255) !important;
137
+ }
138
+ .topology-select-dropdown.theme1 .topology-select-dropdown-list li.selected {
139
+ color: rgb(56, 255, 255) !important;
140
+ }
141
+ .topology-select-dropdown.theme1 .popper__arrow{
142
+ display: none;
143
+ }
package/core/src/poll.js DELETED
@@ -1,37 +0,0 @@
1
- // 轮询
2
- var POLL = /** @class */ (function () {
3
- function POLL(data, message, val) {
4
- this.data = data;
5
- this.client = message;
6
- this.val = val;
7
- this.init();
8
- };
9
- POLL.prototype.init = function () {
10
- let topics = ''
11
- this.getPen(this.data.pens, topics, JSON.stringify(this.client))
12
- };
13
- POLL.prototype.getPen = function (pens, topics, message) {
14
- const _this = this;
15
- pens.forEach((pen)=>{
16
- if(pen.children != undefined){
17
- _this.getPen(pen.children, topics, message)
18
- }else{
19
- var item = pen;
20
- for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
21
- var event_1 = _c[_b];
22
- // if (event_1.type === EventType.Poll) {
23
- if ((event_1.type ===3 && this.val === 'Mqtt') || (event_1.type ===4 && this.val === 'Poll')
24
- || (event_1.type ===5 && this.val === 'Poll1') || (event_1.type ===6 && this.val === 'Poll2')) {
25
- event_1.name = topics;
26
- if(message){
27
- item.doSocketMqtt(event_1, message.toString());
28
- }
29
- }
30
- }
31
- }
32
- })
33
- };
34
- return POLL;
35
- }());
36
- export { POLL };
37
- //# sourceMappingURL=mqtt.js.map
@@ -1,9 +0,0 @@
1
- import { Node } from '../models';
2
- import { visualization2DStore } from '../store';
3
- export declare let DomElements: {};
4
- export declare let DomIframes: {};
5
- export declare function createChildrenDivByElementId(node: Node, data?: visualization2DStore): HTMLDivElement;
6
- export declare function createIframeElement(node: Node): HTMLDivElement;
7
- export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: visualization2DStore): void;
8
- export declare function createDiv(node: Node): HTMLDivElement;
9
- export declare function loadJS(url: string, callback?: () => void, render?: boolean): void;
@@ -1,103 +0,0 @@
1
- import {Store} from 'le5le-store';
2
- import {Lock} from '../models'
3
- import {commonStore} from '../store';
4
-
5
- export let DomElements = {};
6
- export let DomIframes = {};
7
-
8
- export function createChildrenDivByElementId(node, data) {
9
- if (!data) data = commonStore[node.TID] && commonStore[node.TID].data;
10
- // echarts图表的初始化渲染
11
- if (node.elementId) {
12
- if (!DomElements[node.id]) {
13
- DomElements[node.id] = document.getElementById(node.id);
14
- if (DomElements[node.id]) {
15
- document.querySelector('.canvas-point').appendChild(DomElements[node.id]);
16
- }
17
- }
18
- setStyleForElementIdDiv(node, DomElements[node.id], data);
19
- }
20
- // iframe元件的初始化渲染
21
- if (node.iframe) {
22
- if (!DomIframes[node.id]) {
23
- let iframe = document.getElementById(`iframe${node.id}`);
24
- if (!(iframe && iframe.length)) iframe = createIframeElement(node);
25
- DomIframes[node.id] = iframe;
26
- if (DomIframes[node.id]) {
27
- commonStore[node.TID].parentElem.appendChild(DomIframes[node.id]);
28
- }
29
- }
30
- setStyleForElementIdDiv(node, DomIframes[node.id], data);
31
- }
32
- }
33
-
34
- export function createIframeElement(node) {
35
- const iframe = document.createElement('iframe');
36
- // iframe.scrolling = 'no';
37
- iframe.frameBorder = '0';
38
- iframe.src = node.iframe;
39
- iframe.width = node.rect.width;
40
- iframe.height = node.rect.height;
41
- iframe.setAttribute('id', `iframe${node.id}`);
42
- iframe.setAttribute('class', 'topology2dConfIfram');
43
- return iframe;
44
- }
45
-
46
- export function setStyleForElementIdDiv(node, elem, data) {
47
- if (!elem) {
48
- return;
49
- }
50
- elem.style.position = 'absolute';
51
- elem.style.outline = 'none';
52
- elem.style.left = node.rect.x + 'px';
53
- elem.style.top = node.rect.y + 'px';
54
- elem.style.width = node.rect.width + 'px';
55
- elem.style.height = node.rect.height + 'px';
56
- if (node.rotate || node.offsetRotate) {
57
- elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
58
- }
59
- // if (node.video && this.videos[node.id] && this.videos[node.id].media) {
60
- // this.videos[node.id].media.style.width = '100%';
61
- // this.videos[node.id].media.style.height = '100%';
62
- // }
63
- if (data && data.locked > Lock.None || node.locked > Lock.None) {
64
- elem.style.userSelect = 'initial';
65
- elem.style.pointerEvents = 'initial';
66
- } else {
67
- elem.style.userSelect = 'none';
68
- elem.style.pointerEvents = 'none';
69
- }
70
- }
71
-
72
- export function createDiv(node) {
73
- var div = document.createElement('div');
74
- div.style.position = 'absolute';
75
- div.style.outline = 'none';
76
- div.style.left = '-9999px';
77
- div.style.bottom = '-9999px';
78
- div.style.width = node.rect.width + 'px';
79
- div.style.height = node.rect.height + 'px';
80
- // if (node.elementId) {
81
- // div.id = node.elementId;
82
- // }
83
- div.id = node.id;
84
- return div;
85
- }
86
-
87
- // export function loadJS(url, callback, render) {
88
- // var loaderScript = document.createElement('script');
89
- // loaderScript.type = 'text/javascript';
90
- // loaderScript.src = url;
91
- // loaderScript.addEventListener('load', function () {
92
- // if (callback) {
93
- // callback();
94
- // }
95
- // // how to do
96
- // if (render) {
97
- // Store.set('LT:render', true);
98
- // }
99
- // });
100
- // document.body.appendChild(loaderScript);
101
- // }
102
-
103
- //# sourceMappingURL=dom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../packages/core/src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,MAAM,UAAU,SAAS,CAAC,IAAU;IAClC,IAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IAChC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAC3B,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACzC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IAC3C,IAAI,IAAI,CAAC,SAAS,EAAE;QAClB,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;KACzB;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,QAAqB,EAAE,MAAgB;IACzE,IAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtD,YAAY,CAAC,IAAI,GAAG,iBAAiB,CAAC;IACtC,YAAY,CAAC,GAAG,GAAG,GAAG,CAAC;IACvB,YAAY,CAAC,gBAAgB,CAAC,MAAM,EAAE;QACpC,IAAI,QAAQ,EAAE;YACZ,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY;QACZ,IAAI,MAAM,EAAE;YACV,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,196 +0,0 @@
1
- // 源码版写法
2
- import { registerNode } from '../core'
3
-
4
- // 组件版写法和bundle一致
5
- // window.Le5leTopology.registerNode
6
-
7
- // 画骨架
8
-
9
- function drawOuterLine(ctx, node) {
10
- const R = Math.floor((node.rect.width - 6) / 2);
11
- const r = Math.round((R * 1) / 2);
12
-
13
- ctx.beginPath();
14
- // 上半个圆形
15
- ctx.arc(node.rect.x + R, node.rect.y + r, r, 0, Math.PI, true);
16
- // 下半个圆形
17
- const theta = Math.acos((r * 1.0) / R);
18
- ctx.arc(
19
- node.rect.x + R,
20
- node.rect.y + node.rect.height - R,
21
- R,
22
- theta + Math.PI,
23
- -theta,
24
- true
25
- ); // 逆时针
26
- ctx.closePath();
27
- ctx.stroke();
28
- }
29
-
30
- // 画底色
31
- function drawBasic(ctx, node) {
32
- const lingrad = ctx.createLinearGradient(
33
- node.rect.x,
34
- node.rect.y,
35
- node.rect.width,
36
- node.rect.height
37
- );
38
- lingrad.addColorStop(0, 'mediumvioletred');
39
- lingrad.addColorStop(0.2, 'darkorange');
40
- lingrad.addColorStop(0.4, 'gold');
41
- lingrad.addColorStop(0.6, 'limegreen');
42
- lingrad.addColorStop(0.8, 'navy');
43
- lingrad.addColorStop(1, 'purple');
44
- ctx.fillStyle = lingrad;
45
- ctx.fill('evenodd');
46
- }
47
-
48
- function getYByValue(node, i) {
49
- const R = Math.floor((node.rect.width - 6) / 2);
50
- const r = Math.round((R * 1) / 2);
51
-
52
- const min = 0;
53
- const max = 40;
54
-
55
- // 刻度线总高度
56
- const scale_height = node.rect.height - 2 * R - 2 * r;
57
- // 0刻度线所在位置
58
- const zero_scale_y = node.rect.height - 2 * R;
59
- const dy_dtem = scale_height / (max - min);
60
- return zero_scale_y - dy_dtem * node.value;
61
- }
62
-
63
- // 画刻度线
64
- function drawScale(ctx, node) {
65
- const min = 0;
66
- const max = 40;
67
- const R = Math.floor((node.rect.width - 6) / 2);
68
- const r = Math.round((R * 1) / 2);
69
-
70
- for (let i = min; i <= max; i++) {
71
- // 画刻度线
72
- const y = getYByValue(node, i);
73
- ctx.beginPath();
74
- ctx.moveTo(R + r, y);
75
- if (i % 10 == 0) {
76
- ctx.lineWidth = 2;
77
- ctx.lineTo(R + r - (r * 2) / 3, y);
78
- // ctx.font = "15px bold";
79
- ctx.fillText(i + '', R + r, y + 6);
80
- ctx.stroke();
81
- } else {
82
- ctx.lineWidth = 1;
83
- if (i % 5 == 0) {
84
- ctx.lineTo(R + r - r / 2, y);
85
- } else {
86
- ctx.lineTo(R + r - r / 3, y);
87
- }
88
- ctx.stroke();
89
- }
90
- }
91
- }
92
-
93
- /////////////////////
94
- // end 以下代码不完整,代码来自网上改写,仅作参考
95
- /////////////////////
96
-
97
- // 自定义图形库绘画函数
98
- export function thermometer(ctx, node) {
99
- ctx.beginPath();
100
-
101
- drawOuterLine(ctx, node);
102
- drawBasic(ctx, node);
103
- ctx.clearRect(
104
- node.rect.x,
105
- node.rect.y,
106
- node.rect.width,
107
- getYByValue(node, node.value)
108
- );
109
- drawOuterLine(ctx, node);
110
- drawScale(ctx, node);
111
- }
112
-
113
- // 自定义图形库绘画函数
114
- export function pool(ctx, node) {
115
- var wr = node.borderRadius;
116
- var hr = node.borderRadius;
117
- if (node.borderRadius < 1) {
118
- wr = node.rect.width * node.borderRadius;
119
- hr = node.rect.height * node.borderRadius;
120
- }
121
- var r = wr < hr ? wr : hr;
122
- if (node.rect.width < 2 * r) {
123
- r = node.rect.width / 2;
124
- }
125
- if (node.rect.height < 2 * r) {
126
- r = node.rect.height / 2;
127
- }
128
- ctx.beginPath();
129
- ctx.strokeStyle = "rgba(0,0,0,.0)"
130
- var value = (1-node.value) * (node.rect.height - node.lineWidth/2)
131
- ctx.moveTo(node.rect.x + node.lineWidth/2, node.rect.y + value);
132
- ctx.lineTo(node.rect.ex - node.lineWidth/2, node.rect.y + value);
133
- ctx.arcTo(node.rect.ex - node.lineWidth/2, node.rect.y + node.rect.height - node.lineWidth/2, node.rect.x + node.lineWidth/2, node.rect.y + node.rect.height - node.lineWidth/2, r);
134
- ctx.arcTo(node.rect.x + node.lineWidth/2, node.rect.y + node.rect.height - node.lineWidth/2, node.rect.x + node.lineWidth/2, node.rect.y, r);
135
- ctx.lineTo(node.rect.x + node.lineWidth/2, node.rect.y + value);
136
- ctx.closePath();
137
- (node.fillStyle || node.bkType) && ctx.fill();
138
- ctx.stroke();
139
-
140
- ctx.beginPath();
141
- ctx.strokeStyle = node.strokeStyle
142
- ctx.lineWidth = node.lineWidth
143
- ctx.moveTo(node.rect.x + node.rect.width, node.rect.y);
144
- ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r);
145
- ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r);
146
- ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r);
147
- // ctx.closePath();
148
- (node.fillStyle || node.bkType);
149
- ctx.stroke();
150
- }
151
-
152
- // 自定义图形库绘画函数
153
- export function electricFan(ctx, node) {
154
- var wwr = node.rect.width / 2;
155
- var hwr = node.rect.height / 2;
156
- var hwr = node.rect.height / 2;
157
- var x0 = node.rect.x + node.rect.width /2
158
- var y0 = node.rect.y + node.rect.height / 2
159
- var withinRadius = wwr < hwr ? wwr : hwr;
160
- ctx.beginPath();
161
- ctx.lineWidth = node.lineWidth
162
- ctx.arc(x0,y0,withinRadius,0,2*Math.PI);
163
- ctx.closePath();
164
- ctx.stroke();
165
- ctx.beginPath();
166
- ctx.lineWidth = 1;
167
- var fanCount = node.fanCount;
168
- for(var i = 0; i < fanCount; i++){
169
- var fanAngle = 2 * Math.PI / fanCount * i;
170
- var x1 = x0 - withinRadius*Math.sin(fanAngle);
171
- var y1 = y0 - withinRadius*Math.cos(fanAngle);
172
- var xr = x0 - withinRadius*Math.sin(fanAngle)/2;
173
- var yr = y0 - withinRadius*Math.cos(fanAngle)/2;
174
- ctx.moveTo(x0, y0);
175
- ctx.lineTo(x1, y1);
176
- ctx.arc(xr, yr, withinRadius/2, Math.PI / 2 - fanAngle,3 * Math.PI / 2 - fanAngle);
177
- }
178
- ctx.closePath();
179
- (node.fillStyle || node.bkType) && ctx.fill();
180
- ctx.stroke();
181
- ctx.beginPath();
182
- ctx.lineWidth = 3;
183
- ctx.arc(x0,y0,withinRadius/5,0,2*Math.PI);
184
- ctx.closePath();
185
- (node.fillStyle || node.bkType) && ctx.fill();
186
- ctx.stroke();
187
- }
188
-
189
- // 注册自定义图形库
190
- export function registerMyShape() {
191
- registerNode('electricFan', electricFan);
192
- registerNode('pool', pool);
193
- registerNode('thermometer', thermometer);
194
- }
195
-
196
- // src\views\data.ts 里面加载到工具栏,第一个就是此自定义图形库
@@ -1,14 +0,0 @@
1
- export let echartsDataStore = {};
2
- export let echartsOptionsStore = {};
3
- export const destroyEcharts = function(){
4
- for (let node of Object.values(echartsDataStore)) {
5
- if(node) {
6
- clearInterval(node.timeTicket);
7
- node.chart.off('mouseover');
8
- node.chart.off('mouseout');
9
- node.chart.dispose();
10
- }
11
- }
12
- echartsDataStore = {};
13
- echartsOptionsStore = {};
14
- };
File without changes