dcim-topology2d 1.1.6 → 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/index.d.ts +0 -2
- package/chart-diagram/index.js +0 -1
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +104 -106
- 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 -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 -43
- 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 +202 -172
- package/core/src/core.d.ts +4 -3
- package/core/src/core.js +321 -339
- package/core/src/divLayer.d.ts +33 -2
- package/core/src/divLayer.js +292 -41
- package/core/src/healps/changeData.d.ts +1 -1
- package/core/src/healps/changeData.js +44 -102
- 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 -51
- package/core/src/middles/index.js +2 -3
- 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 -6
- package/core/src/models/node.js +16 -29
- package/core/src/models/pen.js +7 -16
- 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 -56
- 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 -6
- package/core/src/utils/dom.js +46 -82
- package/core/src/utils/index.d.ts +0 -1
- package/core/src/utils/index.js +0 -1
- 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/chart-diagram/src/utils/changeOptions.d.ts +0 -4
- package/chart-diagram/src/utils/changeOptions.js +0 -163
- package/chart-diagram/src/utils/conversion.d.ts +0 -17
- package/chart-diagram/src/utils/conversion.js +0 -179
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/index.d.ts +0 -3
- package/chart-diagram/src/utils/index.js +0 -3
- 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/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -12
- package/core/src/middles/nodes/index.d.ts +0 -46
- package/core/src/middles/nodes/index.js +0 -47
- 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 -129
- package/core/src/store/data.js +0 -86
- 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 -3
- package/core/src/utils/assignment.js +0 -69
- package/static/echartsDefaultData.js +0 -239
- package/static/echartsStore.js +0 -14
- package/static/index.js +0 -2
- package/style/index.css +0 -13
package/core/src/divLayer.d.ts
CHANGED
@@ -1,7 +1,34 @@
|
|
1
|
-
import {
|
1
|
+
import { Options } from './options';
|
2
|
+
import { Node } from './models/node';
|
3
|
+
import { TopologyData } from './models/data';
|
2
4
|
import { Layer } from './layer';
|
3
5
|
export declare class DivLayer extends Layer {
|
6
|
+
parentElem: HTMLElement;
|
7
|
+
options: Options;
|
8
|
+
protected data: TopologyData;
|
4
9
|
canvas: HTMLDivElement;
|
10
|
+
player: HTMLDivElement;
|
11
|
+
curNode: Node;
|
12
|
+
playBtn: HTMLElement;
|
13
|
+
currentTime: HTMLElement;
|
14
|
+
progressCurrent: HTMLElement;
|
15
|
+
progress: HTMLElement;
|
16
|
+
loop: HTMLElement;
|
17
|
+
media: HTMLMediaElement;
|
18
|
+
videos: {
|
19
|
+
[key: string]: {
|
20
|
+
player: HTMLElement;
|
21
|
+
current: HTMLElement;
|
22
|
+
media: HTMLMediaElement;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
audios: {
|
26
|
+
[key: string]: {
|
27
|
+
player: HTMLElement;
|
28
|
+
current: HTMLElement;
|
29
|
+
media: HTMLMediaElement;
|
30
|
+
};
|
31
|
+
};
|
5
32
|
iframes: {
|
6
33
|
[key: string]: HTMLIFrameElement;
|
7
34
|
};
|
@@ -13,8 +40,12 @@ export declare class DivLayer extends Layer {
|
|
13
40
|
};
|
14
41
|
private subcribe;
|
15
42
|
private subcribeNode;
|
16
|
-
constructor(TID: String);
|
43
|
+
constructor(parentElem: HTMLElement, options: Options, TID: String);
|
17
44
|
addDiv: (node: Node) => void;
|
45
|
+
createPlayer(): void;
|
46
|
+
getMediaCurrent(): void;
|
47
|
+
addMedia(node: Node, type: string): HTMLDivElement;
|
48
|
+
playNext(next: string): void;
|
18
49
|
addIframe(node: Node): HTMLIFrameElement;
|
19
50
|
addGif(node: Node): HTMLImageElement;
|
20
51
|
setElemPosition(node: Node, elem: HTMLElement): void;
|
package/core/src/divLayer.js
CHANGED
@@ -20,25 +20,46 @@ var __extends = (this && this.__extends) || (function () {
|
|
20
20
|
};
|
21
21
|
})();
|
22
22
|
import {Store} from 'le5le-store';
|
23
|
-
import {Node,
|
23
|
+
import {Node, images} from './models/node';
|
24
|
+
import {Lock} from './models/status';
|
25
|
+
import {PenType} from './models/pen';
|
24
26
|
import {Layer} from './layer';
|
25
|
-
import { setStyleForElementIdDiv,
|
26
|
-
import { commonStore } from './store';
|
27
|
+
import { setStyleForElementIdDiv, DomElements } from './utils'
|
27
28
|
var DivLayer = /** @class */ (function (_super) {
|
28
29
|
__extends(DivLayer, _super);
|
29
|
-
|
30
|
+
|
31
|
+
function DivLayer(parentElem, options, TID) {
|
32
|
+
if (options === void 0) {
|
33
|
+
options = {};
|
34
|
+
}
|
30
35
|
var _this = _super.call(this, TID) || this;
|
36
|
+
_this.parentElem = parentElem;
|
37
|
+
_this.options = options;
|
31
38
|
_this.canvas = document.createElement('div');
|
39
|
+
// _this.player = document.createElement('div');
|
40
|
+
// _this.videos = {};
|
41
|
+
// _this.audios = {};
|
32
42
|
_this.iframes = {};
|
33
43
|
_this.elements = {};
|
34
44
|
_this.gifs = {};
|
35
45
|
_this.addDiv = function (node) {
|
46
|
+
// if (node.audio) {
|
47
|
+
// if (_this.audios[node.id] && _this.audios[node.id].media.src !== node.audio) {
|
48
|
+
// _this.audios[node.id].media.src = node.audio;
|
49
|
+
// }
|
50
|
+
// _this.setElemPosition(node, (_this.audios[node.id] && _this.audios[node.id].player) || _this.addMedia(node, 'audio'));
|
51
|
+
// }
|
52
|
+
// if (node.video) {
|
53
|
+
// if (_this.videos[node.id] && _this.videos[node.id].media.src !== node.video) {
|
54
|
+
// _this.videos[node.id].media.src = node.video;
|
55
|
+
// }
|
56
|
+
// _this.setElemPosition(node, (_this.videos[node.id] && _this.videos[node.id].player) || _this.addMedia(node, 'video'));
|
57
|
+
// }
|
36
58
|
if (node.iframe) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
_this.setElemPosition(node, _this.iframes[node.id] || _this.addIframe(node));
|
59
|
+
if (_this.iframes[node.id] && _this.iframes[node.id].src !== node.iframe) {
|
60
|
+
_this.iframes[node.id].src = node.iframe;
|
61
|
+
}
|
62
|
+
_this.setElemPosition(node, _this.iframes[node.id] || _this.addIframe(node));
|
42
63
|
}
|
43
64
|
if (node.elementId) {
|
44
65
|
Object.assign(_this.elements, DomElements);
|
@@ -74,23 +95,248 @@ var DivLayer = /** @class */ (function (_super) {
|
|
74
95
|
}
|
75
96
|
}
|
76
97
|
};
|
98
|
+
_this.data = Store.get(_this.generateStoreKey('topology-data'));
|
99
|
+
// if (!_this.options.playIcon) {
|
100
|
+
// _this.options.playIcon = 'iconfont icon-play';
|
101
|
+
// }
|
102
|
+
// if (!_this.options.pauseIcon) {
|
103
|
+
// _this.options.pauseIcon = 'iconfont icon-pause';
|
104
|
+
// }
|
105
|
+
// if (!_this.options.fullScreenIcon) {
|
106
|
+
// _this.options.fullScreenIcon = 'iconfont icon-full-screen';
|
107
|
+
// }
|
108
|
+
// if (!_this.options.loopIcon) {
|
109
|
+
// _this.options.loopIcon = 'iconfont icon-loop';
|
110
|
+
// }
|
77
111
|
_this.canvas.style.position = 'absolute';
|
78
112
|
_this.canvas.style.left = '0';
|
79
113
|
_this.canvas.style.top = '0';
|
80
114
|
_this.canvas.style.outline = 'none';
|
81
115
|
_this.canvas.style.background = 'transparent';
|
82
116
|
_this.canvas.setAttribute('class', 'canvas-point');
|
83
|
-
|
117
|
+
parentElem.appendChild(_this.canvas);
|
118
|
+
// parentElem.appendChild(_this.player);
|
119
|
+
//_this.createPlayer();
|
84
120
|
_this.subcribe = Store.subscribe(_this.generateStoreKey('LT:addDiv'), _this.addDiv);
|
121
|
+
// _this.subcribeNode = Store.subscribe(_this.generateStoreKey('LT:activeNode'), function (node) {
|
122
|
+
// if (!node || (!node.video && !node.audio)) {
|
123
|
+
// _this.player.style.top = '-99999px';
|
124
|
+
// return;
|
125
|
+
// }
|
126
|
+
// if (node.audio && _this.audios[node.id]) {
|
127
|
+
// _this.media = _this.audios[node.id].media;
|
128
|
+
// }
|
129
|
+
// else if (node.video && _this.videos[node.id]) {
|
130
|
+
// _this.media = _this.videos[node.id].media;
|
131
|
+
// }
|
132
|
+
// else {
|
133
|
+
// return;
|
134
|
+
// }
|
135
|
+
// _this.curNode = node;
|
136
|
+
// _this.player.style.top = _this.parentElem.offsetTop + _this.parentElem.clientHeight + 'px';
|
137
|
+
// _this.player.style.left = _this.parentElem.getBoundingClientRect().left + 'px';
|
138
|
+
// _this.player.style.width = _this.parentElem.clientWidth + 'px';
|
139
|
+
// _this.getMediaCurrent();
|
140
|
+
// if (_this.media.paused) {
|
141
|
+
// _this.playBtn.className = _this.options.playIcon;
|
142
|
+
// }
|
143
|
+
// else {
|
144
|
+
// _this.playBtn.className = _this.options.pauseIcon;
|
145
|
+
// }
|
146
|
+
// });
|
147
|
+
// document.addEventListener('fullscreenchange', function (e) {
|
148
|
+
// if (!_this.media) {
|
149
|
+
// return;
|
150
|
+
// }
|
151
|
+
// if (document.fullscreen) {
|
152
|
+
// _this.media.controls = true;
|
153
|
+
// _this.media.style.userSelect = 'initial';
|
154
|
+
// _this.media.style.pointerEvents = 'initial';
|
155
|
+
// }
|
156
|
+
// else {
|
157
|
+
// _this.media.style.userSelect = 'none';
|
158
|
+
// _this.media.style.pointerEvents = 'none';
|
159
|
+
// _this.media.controls = false;
|
160
|
+
// }
|
161
|
+
// });
|
85
162
|
return _this;
|
86
163
|
}
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
164
|
+
|
165
|
+
DivLayer.prototype.createPlayer = function () {
|
166
|
+
var _this = this;
|
167
|
+
this.player.style.position = 'fixed';
|
168
|
+
this.player.style.outline = 'none';
|
169
|
+
this.player.style.top = '-99999px';
|
170
|
+
this.player.style.height = '40px';
|
171
|
+
this.player.style.padding = '10px 15px';
|
172
|
+
this.player.style.background = 'rgba(200,200,200,.1)';
|
173
|
+
this.player.style.display = 'flex';
|
174
|
+
this.player.style.alignItems = 'center';
|
175
|
+
this.player.style.userSelect = 'initial';
|
176
|
+
this.player.style.pointerEvents = 'initial';
|
177
|
+
this.player.style.zIndex = '1';
|
178
|
+
this.playBtn = document.createElement('i');
|
179
|
+
this.currentTime = document.createElement('span');
|
180
|
+
this.progress = document.createElement('div');
|
181
|
+
this.progressCurrent = document.createElement('div');
|
182
|
+
this.loop = document.createElement('i');
|
183
|
+
var fullScreen = document.createElement('i');
|
184
|
+
this.playBtn.className = this.options.playIcon;
|
185
|
+
this.playBtn.style.fontSize = '18px';
|
186
|
+
this.playBtn.style.lineHeight = '20px';
|
187
|
+
this.playBtn.style.cursor = 'pointer';
|
188
|
+
this.currentTime.style.padding = '0 10px';
|
189
|
+
this.currentTime.innerText = '0 / 0';
|
190
|
+
this.progress.style.position = 'relative';
|
191
|
+
this.progress.style.flexGrow = '1';
|
192
|
+
this.progress.style.top = '0';
|
193
|
+
this.progress.style.height = '4px';
|
194
|
+
this.progress.style.background = '#ccc';
|
195
|
+
this.progress.style.borderRadius = '2px';
|
196
|
+
this.progress.style.overflow = 'hidden';
|
197
|
+
this.progress.style.cursor = 'pointer';
|
198
|
+
this.progressCurrent.style.position = 'absolute';
|
199
|
+
this.progressCurrent.style.left = '0';
|
200
|
+
this.progressCurrent.style.top = '0';
|
201
|
+
this.progressCurrent.style.bottom = '0';
|
202
|
+
this.progressCurrent.style.width = '0';
|
203
|
+
this.progressCurrent.style.background = '#52c41a';
|
204
|
+
this.loop.style.margin = '0 10px';
|
205
|
+
this.loop.style.padding = '2px 5px';
|
206
|
+
this.loop.style.borderRadius = '2px';
|
207
|
+
this.loop.className = this.options.loopIcon;
|
208
|
+
this.loop.style.fontSize = '18px';
|
209
|
+
this.loop.style.lineHeight = '20px';
|
210
|
+
this.loop.style.cursor = 'pointer';
|
211
|
+
fullScreen.className = this.options.fullScreenIcon;
|
212
|
+
fullScreen.style.fontSize = '17px';
|
213
|
+
fullScreen.style.lineHeight = '20px';
|
214
|
+
fullScreen.style.cursor = 'pointer';
|
215
|
+
this.player.appendChild(this.playBtn);
|
216
|
+
this.player.appendChild(this.currentTime);
|
217
|
+
this.player.appendChild(this.progress);
|
218
|
+
this.progress.appendChild(this.progressCurrent);
|
219
|
+
this.player.appendChild(this.loop);
|
220
|
+
this.player.appendChild(fullScreen);
|
221
|
+
this.playBtn.onclick = function () {
|
222
|
+
if (_this.media.paused) {
|
223
|
+
_this.media.play();
|
224
|
+
_this.playBtn.className = _this.options.pauseIcon;
|
225
|
+
} else {
|
226
|
+
_this.media.pause();
|
227
|
+
_this.playBtn.className = _this.options.playIcon;
|
228
|
+
}
|
229
|
+
};
|
230
|
+
this.progress.onclick = function (e) {
|
231
|
+
_this.media.currentTime = (e.offsetX / _this.progress.clientWidth) * _this.media.duration;
|
232
|
+
};
|
233
|
+
this.loop.onclick = function () {
|
234
|
+
_this.media.loop = !_this.media.loop;
|
235
|
+
_this.curNode.playLoop = _this.media.loop;
|
236
|
+
if (_this.media.loop) {
|
237
|
+
_this.loop.style.background = '#ddd';
|
238
|
+
} else {
|
239
|
+
_this.loop.style.background = 'none';
|
240
|
+
}
|
241
|
+
};
|
242
|
+
fullScreen.onclick = function () {
|
243
|
+
_this.media.requestFullscreen();
|
244
|
+
};
|
245
|
+
};
|
246
|
+
DivLayer.prototype.getMediaCurrent = function () {
|
247
|
+
if (!this.media) {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
this.currentTime.innerText =
|
251
|
+
this.formatSeconds(this.media.currentTime) + ' / ' + this.formatSeconds(this.media.duration);
|
252
|
+
this.progressCurrent.style.width =
|
253
|
+
(this.media.currentTime / this.media.duration) * this.progress.clientWidth + 'px';
|
254
|
+
};
|
255
|
+
DivLayer.prototype.addMedia = function (node, type) {
|
256
|
+
var _this = this;
|
257
|
+
var player = document.createElement('div');
|
258
|
+
var current = document.createElement('div');
|
259
|
+
var media = document.createElement(type);
|
260
|
+
current.style.position = 'absolute';
|
261
|
+
current.style.outline = 'none';
|
262
|
+
current.style.left = '0';
|
263
|
+
current.style.bottom = '0';
|
264
|
+
current.style.height = '2px';
|
265
|
+
current.style.background = '#52c41a';
|
266
|
+
media.style.position = 'absolute';
|
267
|
+
media.style.outline = 'none';
|
268
|
+
media.style.left = '0';
|
269
|
+
media.style.right = '0';
|
270
|
+
media.style.top = '0';
|
271
|
+
media.style.bottom = '0';
|
272
|
+
if (type === 'video') {
|
273
|
+
media.style.width = node.rect.width + 'px';
|
274
|
+
media.style.height = node.rect.height + 'px';
|
275
|
+
}
|
276
|
+
player.style.background = 'transparent';
|
277
|
+
if (node.play === 1) {
|
278
|
+
media.autoplay = true;
|
279
|
+
}
|
280
|
+
media.loop = node.playLoop;
|
281
|
+
media.ontimeupdate = function () {
|
282
|
+
current.style.width = (media.currentTime / media.duration) * node.rect.width + 'px';
|
283
|
+
_this.getMediaCurrent();
|
284
|
+
if (_this.media === media) {
|
285
|
+
if (node.playLoop) {
|
286
|
+
media.loop = true;
|
287
|
+
_this.loop.style.background = '#ddd';
|
288
|
+
} else {
|
289
|
+
media.loop = false;
|
290
|
+
_this.loop.style.background = 'none';
|
291
|
+
}
|
292
|
+
}
|
293
|
+
};
|
294
|
+
media.onended = function () {
|
295
|
+
Store.set(_this.generateStoreKey('mediaEnd'), node);
|
296
|
+
if (_this.media === media) {
|
297
|
+
_this.playBtn.className = _this.options.playIcon;
|
298
|
+
}
|
299
|
+
_this.playNext(node.nextPlay);
|
300
|
+
};
|
301
|
+
media.onloadedmetadata = function () {
|
302
|
+
_this.getMediaCurrent();
|
303
|
+
};
|
304
|
+
media.src = node[type];
|
305
|
+
player.appendChild(media);
|
306
|
+
player.appendChild(current);
|
307
|
+
this[type + 's'][node.id] = {
|
308
|
+
player: player,
|
309
|
+
current: current,
|
310
|
+
media: media
|
311
|
+
};
|
312
|
+
this.canvas.appendChild(player);
|
313
|
+
return player;
|
314
|
+
};
|
315
|
+
DivLayer.prototype.playNext = function (next) {
|
316
|
+
if (!next) {
|
317
|
+
return;
|
318
|
+
}
|
319
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
320
|
+
var item = _a[_i];
|
321
|
+
if (!(item instanceof Node)) {
|
322
|
+
continue;
|
323
|
+
}
|
324
|
+
if (item.tags.indexOf(next) > -1) {
|
325
|
+
if (item.audio && this.audios[item.id] && this.audios[item.id].media && this.audios[item.id].media.paused) {
|
326
|
+
this.audios[item.id].media.play();
|
327
|
+
} else if (item.video && this.videos[item.id].media && this.videos[item.id].media.paused) {
|
328
|
+
this.videos[item.id].media.play();
|
329
|
+
}
|
330
|
+
}
|
93
331
|
}
|
332
|
+
};
|
333
|
+
DivLayer.prototype.addIframe = function (node) {
|
334
|
+
var iframe = document.createElement('iframe');
|
335
|
+
iframe.scrolling = 'no';
|
336
|
+
iframe.frameBorder = '0';
|
337
|
+
iframe.src = node.iframe;
|
338
|
+
this.iframes[node.id] = iframe;
|
339
|
+
this.canvas.appendChild(iframe);
|
94
340
|
return iframe;
|
95
341
|
};
|
96
342
|
DivLayer.prototype.addGif = function (node) {
|
@@ -99,21 +345,30 @@ var DivLayer = /** @class */ (function (_super) {
|
|
99
345
|
return node.img;
|
100
346
|
};
|
101
347
|
DivLayer.prototype.setElemPosition = function (node, elem) {
|
102
|
-
setStyleForElementIdDiv(node, elem,
|
348
|
+
setStyleForElementIdDiv(node, elem, this.data);
|
103
349
|
};
|
104
350
|
DivLayer.prototype.removeDiv = function (item) {
|
105
351
|
if (this.curNode && item.id === this.curNode.id) {
|
106
352
|
this.curNode = null;
|
353
|
+
// this.media = null;
|
354
|
+
// this.player.style.top = '-99999px';
|
107
355
|
}
|
356
|
+
// if (item.audio) {
|
357
|
+
// this.canvas.removeChild(this.audios[item.id].player);
|
358
|
+
// this.audios[item.id] = null;
|
359
|
+
// }
|
360
|
+
// if (item.video) {
|
361
|
+
// this.canvas.removeChild(this.videos[item.id].player);
|
362
|
+
// this.videos[item.id] = null;
|
363
|
+
// }
|
108
364
|
if (item.iframe) {
|
109
|
-
|
110
|
-
|
111
|
-
this.iframes[item.id] ? this.iframes[item.id] = null : DomIframes[item.id] = null;
|
365
|
+
this.canvas.removeChild(this.iframes[item.id]);
|
366
|
+
this.iframes[item.id] = null;
|
112
367
|
}
|
113
368
|
if (item.elementId) {
|
114
369
|
const elementNode = this.elements[item.id] || DomElements[item.id];
|
115
370
|
this.canvas.removeChild(elementNode);
|
116
|
-
this.elements[item.id]
|
371
|
+
this.elements[item.id] = null;
|
117
372
|
}
|
118
373
|
if (item.gif) {
|
119
374
|
this.canvas.removeChild(this.gifs[item.id]);
|
@@ -131,22 +386,19 @@ var DivLayer = /** @class */ (function (_super) {
|
|
131
386
|
};
|
132
387
|
DivLayer.prototype.clear = function () {
|
133
388
|
this.canvas.innerHTML = '';
|
389
|
+
//this.audios = {};
|
390
|
+
//this.videos = {};
|
134
391
|
this.iframes = {};
|
135
392
|
this.elements = {};
|
136
393
|
this.gifs = {};
|
137
|
-
for (
|
138
|
-
delete DomIframes[key];
|
139
|
-
}
|
140
|
-
for (let key in DomElements) {
|
394
|
+
for (var key in DomElements) {
|
141
395
|
delete DomElements[key];
|
142
396
|
}
|
143
397
|
// tslint:disable-next-line:forin
|
144
|
-
for (
|
398
|
+
for (var key in images) {
|
145
399
|
delete images[key];
|
146
400
|
}
|
147
|
-
|
148
|
-
delete defaultImages[key];
|
149
|
-
}
|
401
|
+
//this.player.style.top = '-99999px';
|
150
402
|
};
|
151
403
|
DivLayer.prototype.formatSeconds = function (seconds) {
|
152
404
|
var h = Math.floor(seconds / 3600);
|
@@ -164,30 +416,25 @@ var DivLayer = /** @class */ (function (_super) {
|
|
164
416
|
return txt;
|
165
417
|
};
|
166
418
|
DivLayer.prototype.resize = function (size) {
|
167
|
-
let store = commonStore[this.TID];
|
168
|
-
if(!store || !store.options) return;
|
169
419
|
if (size) {
|
170
420
|
this.canvas.style.width = size.width + 'px';
|
171
421
|
this.canvas.style.height = size.height + 'px';
|
172
422
|
} else {
|
173
|
-
if (
|
174
|
-
this.canvas.style.width =
|
423
|
+
if (this.options.width && this.options.width !== 'auto') {
|
424
|
+
this.canvas.style.width = this.options.width + 'px';
|
175
425
|
} else {
|
176
|
-
this.canvas.style.width =
|
426
|
+
this.canvas.style.width = this.parentElem.clientWidth + 'px';
|
177
427
|
}
|
178
|
-
if (
|
179
|
-
this.canvas.style.height =
|
428
|
+
if (this.options.height && this.options.height !== 'auto') {
|
429
|
+
this.canvas.style.height = this.options.height + 'px';
|
180
430
|
} else {
|
181
|
-
this.canvas.style.height =
|
431
|
+
this.canvas.style.height = this.parentElem.clientHeight - 8 + 'px';
|
182
432
|
}
|
183
433
|
}
|
184
|
-
store = null;
|
185
434
|
};
|
186
435
|
DivLayer.prototype.render = function () {
|
187
|
-
|
188
|
-
for (var _i = 0, _a = commonStore[this.TID].data.pens; _i < _a.length; _i++) {
|
436
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
189
437
|
var item = _a[_i];
|
190
|
-
if(!(item instanceof Node)) item = new Node(item);
|
191
438
|
if (!item.getTID()) {
|
192
439
|
item.setTID(this.TID);
|
193
440
|
}
|
@@ -198,6 +445,8 @@ var DivLayer = /** @class */ (function (_super) {
|
|
198
445
|
DivLayer.prototype.destroy = function () {
|
199
446
|
this.clear();
|
200
447
|
this.subcribe.unsubscribe();
|
448
|
+
//this.subcribeNode.unsubscribe();
|
449
|
+
|
201
450
|
//优化
|
202
451
|
this.canvas.onmousemove = null;
|
203
452
|
this.canvas.onmousedown = null
|
@@ -208,6 +457,8 @@ var DivLayer = /** @class */ (function (_super) {
|
|
208
457
|
this.canvas.ondragover = null;
|
209
458
|
this.canvas.ondrop = null;
|
210
459
|
this.canvas.onwheel = null;
|
460
|
+
|
461
|
+
this.data = null;
|
211
462
|
//end
|
212
463
|
};
|
213
464
|
|
@@ -5,4 +5,4 @@ export declare function setNodeEvents(item: any[], pen: Pen): void;
|
|
5
5
|
export declare function setControlData(pen: Pen, syncData: Node): void;
|
6
6
|
export declare function getControlNode(item: any, data: any): Node;
|
7
7
|
export declare function getDetailData(data: Node): void;
|
8
|
-
export declare function setStatisticalData(pen: Pen,
|
8
|
+
export declare function setStatisticalData(pen: Pen, data: any): Node;
|