Revize 73ef4efb
Přidáno uživatelem Pavel Fidranský před téměř 6 roky(ů)
sources/src/main/webapp/js/components/group.js | ||
---|---|---|
219 | 219 |
* @returns {SVGElement} SVG DOM element. |
220 | 220 |
*/ |
221 | 221 |
_renderIncluded() { |
222 |
// root |
|
222 | 223 |
this._rootElement = DOM.s('svg', { |
223 | 224 |
class: 'node group', |
224 | 225 |
x: this.position.x, |
... | ... | |
283 | 284 |
y2: 15, |
284 | 285 |
}), |
285 | 286 |
]), |
287 |
// symbol list |
|
288 |
this._symbolListComponent.render(), |
|
286 | 289 |
]); |
287 | 290 |
|
288 |
// symbol list |
|
289 |
this._symbolListComponent = new NodeSymbolList; |
|
290 |
this._rootElement.appendChild(this._symbolListComponent.render()); |
|
291 |
|
|
292 |
this._symbolList.forEach(symbol => { |
|
293 |
this._symbolListComponent.appendChild(symbol); |
|
294 |
}); |
|
295 |
|
|
296 | 291 |
return this._rootElement; |
297 | 292 |
} |
298 | 293 |
|
sources/src/main/webapp/js/components/node.js | ||
---|---|---|
16 | 16 |
/** @prop {function} removeFromSidebarList Hook function used to remove the node from the sidebar list it is located in before it is moved to the viewport. */ |
17 | 17 |
this.removeFromSidebarList = Utils.noop; |
18 | 18 |
|
19 |
// components |
|
20 |
this._symbolListComponent = new NodeSymbolList; |
|
21 |
|
|
19 | 22 |
this._position = null; |
20 | 23 |
this._size = null; |
21 | 24 |
this._proxy = null; |
... | ... | |
31 | 34 |
this._isArchetypeNeighboursHighlighted = false; |
32 | 35 |
this._isNeighbourIconsDisplayed = false; |
33 | 36 |
|
34 |
this._symbolList = []; |
|
35 | 37 |
this._relatedArchetypeMap = {}; |
36 | 38 |
} |
37 | 39 |
|
... | ... | |
40 | 42 |
* @param {array} symbol Node symbol to be added. |
41 | 43 |
*/ |
42 | 44 |
addSymbol(symbol) { |
43 |
this._symbolList.push(symbol); |
|
44 |
|
|
45 | 45 |
if (this.isExcluded) return; |
46 | 46 |
|
47 |
this._symbolListComponent.appendChild(symbol);
|
|
47 |
this._symbolListComponent.add(symbol);
|
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
/** |
... | ... | |
52 | 52 |
* @param {array} symbol Node symbol to be removed. |
53 | 53 |
*/ |
54 | 54 |
removeSymbol(symbol) { |
55 |
this._symbolList.splice(this._symbolList.indexOf(symbol), 1); |
|
56 |
|
|
57 | 55 |
if (this.isExcluded) return; |
58 | 56 |
|
59 |
this._symbolListComponent.removeChild(symbol);
|
|
57 |
this._symbolListComponent.remove(symbol); |
|
60 | 58 |
} |
61 | 59 |
|
62 | 60 |
/** |
sources/src/main/webapp/js/components/nodeSymbolList.js | ||
---|---|---|
7 | 7 |
* @constructor |
8 | 8 |
*/ |
9 | 9 |
constructor() { |
10 |
this._symbolList = []; |
|
11 |
|
|
10 | 12 |
this._width = 20; |
11 | 13 |
this._height = 20; |
12 | 14 |
} |
... | ... | |
29 | 31 |
* @public |
30 | 32 |
* @param {array} symbol Symbol to be added to the list. |
31 | 33 |
*/ |
32 |
appendChild(symbol) { |
|
34 |
add(symbol) { |
|
35 |
this._symbolList.push(symbol); |
|
36 |
|
|
33 | 37 |
this._rootElement.appendChild(DOM.s('g', { |
34 | 38 |
class: 'neighbour-node-symbol ' + symbol[2], |
35 | 39 |
}, [ |
... | ... | |
56 | 60 |
* @public |
57 | 61 |
* @param {array} symbol Symbol to be removed from the list. |
58 | 62 |
*/ |
59 |
removeChild(symbol) { |
|
63 |
remove(symbol) { |
|
64 |
this._symbolList.splice(this._symbolList.indexOf(symbol), 1); |
|
65 |
|
|
60 | 66 |
let symbolGroup = this._rootElement.querySelector('.' + symbol[2]); |
61 | 67 |
|
62 | 68 |
symbolGroup.remove(); |
sources/src/main/webapp/js/components/vertex.js | ||
---|---|---|
218 | 218 |
* @returns {SVGElement} SVG DOM element. |
219 | 219 |
*/ |
220 | 220 |
_renderIncluded() { |
221 |
// root |
|
221 | 222 |
this._rootElement = DOM.s('svg', { |
222 | 223 |
class: 'node vertex', |
223 | 224 |
x: this.position.x, |
... | ... | |
250 | 251 |
}, [ |
251 | 252 |
DOM.t(this.name), |
252 | 253 |
]), |
254 |
// symbol list |
|
255 |
this._symbolListComponent.render(), |
|
253 | 256 |
]); |
254 | 257 |
|
255 |
// symbol list |
|
256 |
this._symbolListComponent = new NodeSymbolList; |
|
257 |
this._rootElement.appendChild(this._symbolListComponent.render()); |
|
258 |
|
|
259 |
this._symbolList.forEach(symbol => { |
|
260 |
this._symbolListComponent.appendChild(symbol); |
|
261 |
}); |
|
262 |
|
|
263 | 258 |
// related archetype icons |
264 | 259 |
const relatedArchetypeListContainer = DOM.s('g', { |
265 | 260 |
transform: `translate(${this.size.width}, 0)`, |
Také k dispozici: Unified diff
Node uses NodeSymbolList to store its currently displayed symbols