Revize 15e7f9e5
Přidáno uživatelem Tomáš Šimandl před více než 6 roky(ů)
sources/src/main/webapp/js/components/group.js | ||
---|---|---|
398 | 398 |
app.viewportComponent.removeGroup(this); |
399 | 399 |
|
400 | 400 |
if(showIcon){ |
401 |
//showIconClick.bind(this)(null) // TODO implement
|
|
401 |
showIconClick.bind(this)(null)
|
|
402 | 402 |
} |
403 | 403 |
}; |
404 | 404 |
|
... | ... | |
411 | 411 |
this.setExcluded(false); |
412 | 412 |
this.remove(false); |
413 | 413 |
|
414 |
if(iconsDisplayed) { |
|
415 |
showIconClick.bind(this)(null); |
|
416 |
} |
|
417 |
|
|
414 | 418 |
app.viewportComponent.addGroup(this); |
415 | 419 |
|
416 | 420 |
// set edges' ends |
... | ... | |
702 | 706 |
}); |
703 | 707 |
rootElement.appendChild(buttonGroup); |
704 | 708 |
|
709 |
// show symbol button |
|
710 |
var showSymbolButton = app.utils.createHtmlElement('button', { |
|
711 |
'class': 'show-symbol-button button', |
|
712 |
'style': 'background-color: ' + this.symbol[1] + ';', |
|
713 |
'title': 'Show symbol next to all neighbouring components', |
|
714 |
}); |
|
715 |
showSymbolButton.appendChild(document.createTextNode(this.symbol[0])); |
|
716 |
showSymbolButton.addEventListener('click', showIconClick.bind(this)); |
|
717 |
buttonGroup.appendChild(showSymbolButton); |
|
718 |
|
|
705 | 719 |
// include button |
706 | 720 |
var includeButton = app.utils.createHtmlElement('button', { |
707 | 721 |
'class': 'include-button button', |
... | ... | |
786 | 800 |
} |
787 | 801 |
} |
788 | 802 |
|
803 |
/** |
|
804 |
* Displays symbol of the group next to all nodes that it is connected with. |
|
805 |
* @param {MouseEvent} e Click event. |
|
806 |
*/ |
|
807 |
function showIconClick(e) { |
|
808 |
iconsDisplayed = !iconsDisplayed; |
|
809 |
|
|
810 |
var neighbourList = []; |
|
811 |
|
|
812 |
this.getInEdgeList().filter(function (edge) { |
|
813 |
return !edge.getFrom().isExcluded(); |
|
814 |
}).forEach(function (edge) { |
|
815 |
if (!neighbourList.includes(edge.getFrom())) { |
|
816 |
neighbourList.push(edge.getFrom()); |
|
817 |
} |
|
818 |
}); |
|
819 |
|
|
820 |
this.getOutEdgeList().filter(function (edge) { |
|
821 |
return !edge.getTo().isExcluded(); |
|
822 |
}).forEach(function (edge) { |
|
823 |
if (!neighbourList.includes(edge.getTo())) { |
|
824 |
neighbourList.push(edge.getTo()); |
|
825 |
} |
|
826 |
}); |
|
827 |
|
|
828 |
neighbourList.forEach(function(node) { |
|
829 |
if (iconsDisplayed) { |
|
830 |
node.addSymbol(this.symbol); |
|
831 |
} else { |
|
832 |
node.removeSymbol(this.symbol); |
|
833 |
} |
|
834 |
}, this); |
|
835 |
} |
|
836 |
|
|
789 | 837 |
/** |
790 | 838 |
* Includes the group back to the viewport. |
791 | 839 |
*/ |
Také k dispozici: Unified diff
add possibility to show symbol in neighbors of groups