Revize 4b16b670
Přidáno uživatelem Pavel Fidranský před více než 6 roky(ů)
sources/src/main/webapp/js/components/vertex.js | ||
---|---|---|
6 | 6 |
function Vertex(props) { |
7 | 7 |
/** @prop {integer} id Unique identifier of the vertex. */ |
8 | 8 |
this.id = props.id; |
9 |
/** @prop {integer} archetype Archetype of the vertex. */ |
|
10 |
this.archetype = app.archetype.vertex[props.archetype]; |
|
9 | 11 |
/** @prop {string} name Name of the vertex. */ |
10 | 12 |
this.name = props.name; |
11 | 13 |
/** @prop {array} symbol Symbol of the group. */ |
... | ... | |
431 | 433 |
'x': 1, |
432 | 434 |
'y': 1, |
433 | 435 |
})); |
434 |
|
|
435 |
// interface |
|
436 |
var interface = app.utils.createSvgElement('g', { |
|
437 |
'class': 'interface', |
|
438 |
'transform': 'translate(8, 8)', |
|
436 |
|
|
437 |
// archetype |
|
438 |
var archetype = app.utils.createSvgElement('g', { |
|
439 |
'class': 'archetype', |
|
440 |
'data-vertexId': this.id, |
|
441 |
'transform': 'translate(7, 6)', |
|
439 | 442 |
}); |
440 |
interface.addEventListener('click', interfaceClick.bind(this)); |
|
441 |
|
|
442 |
interface.appendChild(app.utils.createSvgElement('rect', { |
|
443 |
'width': 10, |
|
444 |
'height': 15, |
|
445 |
'x': 0, |
|
446 |
'y': 0, |
|
447 |
})); |
|
448 |
interface.appendChild(app.utils.createSvgElement('rect', { |
|
449 |
'width': 6, |
|
450 |
'height': 3, |
|
451 |
'x': -3, |
|
452 |
'y': 3, |
|
453 |
})); |
|
454 |
interface.appendChild(app.utils.createSvgElement('rect', { |
|
455 |
'width': 6, |
|
456 |
'height': 3, |
|
457 |
'x': -3, |
|
458 |
'y': 9, |
|
459 |
})); |
|
460 |
rootElement.appendChild(interface); |
|
461 |
|
|
443 |
archetype.addEventListener('click', archetypeClick.bind(this)); |
|
444 |
|
|
445 |
archetype.innerHTML = app.archetype.icon[this.archetype.name]; |
|
446 |
|
|
447 |
rootElement.appendChild(archetype); |
|
448 |
|
|
462 | 449 |
// name |
463 | 450 |
var nameText = app.utils.createSvgElement('text', { |
464 | 451 |
'fill': 'black', |
... | ... | |
712 | 699 |
* Reveals vertex popover. |
713 | 700 |
* @param {Event} e Click event. |
714 | 701 |
*/ |
715 |
function interfaceClick(e) {
|
|
702 |
function archetypeClick(e) {
|
|
716 | 703 |
e.stopPropagation(); |
717 | 704 |
|
718 |
app.viewportComponent.vertexPopoverComponent.setContent(props.symbolicName, props.exportedPackages, props.importedPackages);
|
|
705 |
app.viewportComponent.vertexPopoverComponent.setContent(this.name + ` (${this.archetype.name})`, props.exportedPackages);
|
|
719 | 706 |
app.viewportComponent.vertexPopoverComponent.setPosition(new Coordinates(e.clientX, e.clientY)); |
720 | 707 |
app.viewportComponent.vertexPopoverComponent.open(); |
721 | 708 |
} |
Také k dispozici: Unified diff
replaced Vertex interface icon by icon according to its archetype