
svg.default.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
The newest version!
(function (){
function escapeForCssAttributeSelector(entityName) {
return entityName
?.replaceAll('\\', '\\\\')
?.replaceAll('"', '\\"');
}
function getEdgesAndDistance1Nodes(startingNode) {
const nodeName = startingNode.getAttribute("data-entity");
const escapedNodeName = escapeForCssAttributeSelector(nodeName);
let results = new Set();
svg.querySelectorAll(`.link[data-entity-1="${escapedNodeName}"], .link[data-entity-2="${escapedNodeName}"]`).forEach(link => {
const linkStartNodeName = link.getAttribute("data-entity-1");
const linkEndNodeName = link.getAttribute("data-entity-2");
if (linkStartNodeName === nodeName) {
results.add(svg.querySelector(`[data-entity="${escapeForCssAttributeSelector(linkEndNodeName)}"]`));
results.add(link);
} else if (linkEndNodeName === nodeName) {
results.add(svg.querySelector(`[data-entity="${escapeForCssAttributeSelector(linkStartNodeName)}"]`));
results.add(link);
}
});
return results;
}
/**
* @param {SVGElement} elem
* @param tagName in lowercase, e.g. "g" or "svg"
* @return {{SVGElement}} or null if no matching ancestor is found
*/
function findAncestorWithTagName(elem, tagName) {
while (elem && elem.nodeName.toLowerCase() !== tagName) {
elem = elem.parentElement;
}
return elem;
}
function onClickEntity() {
if (svg.classList.contains("click-active") && this.classList.contains("click-selected")) {
handleDeselect("click");
} else {
handleSelect(this, "click");
}
}
function onMouseOverEntity() {
handleSelect(this, "mouseover");
}
function onMouseOutEntity() {
handleDeselect("mouseover");
}
// CSS class descriptions:
// xxx-active: highlight styles will be ignored when this is not added to the the parent
© 2015 - 2025 Weber Informatics LLC | Privacy Policy