This commit is contained in:
Nikolay Rozhkov 2023-06-22 23:50:11 +03:00
parent 73840ead05
commit d766ac6d20
2 changed files with 17 additions and 25 deletions

View File

@ -41,7 +41,7 @@ export const draw = function (text: string, id: string, _version: string, diagOb
let root = d3select('body');
if (securityLevel === 'sandbox' && sandboxElement) {
root = d3select(sandboxElement.nodes()[0].contentDocument.body)
root = d3select(sandboxElement.nodes()[0].contentDocument.body);
}
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
const svg = securityLevel === 'sandbox' ? root.select(`[id="${id}"]`) : d3select(`[id="${id}"]`);
@ -150,21 +150,22 @@ export const draw = function (text: string, id: string, _version: string, diagOb
.attr('class', 'link')
.style('mix-blend-mode', 'multiply');
const gradient = link.append("linearGradient")
.attr("id", d => (d.uid = Uid.next("linearGradient-")).id)
.attr("gradientUnits", "userSpaceOnUse")
.attr("x1", d => d.source.x1)
.attr("x2", d => d.target.x0);
const gradient = link
.append('linearGradient')
.attr('id', (d) => (d.uid = Uid.next('linearGradient-')).id)
.attr('gradientUnits', 'userSpaceOnUse')
.attr('x1', (d) => d.source.x1)
.attr('x2', (d) => d.target.x0);
gradient
.append("stop")
.attr("offset", "0%")
.attr("stop-color", d => colorScheme(d.source.id));
.append('stop')
.attr('offset', '0%')
.attr('stop-color', (d) => colorScheme(d.source.id));
gradient
.append("stop")
.attr("offset", "100%")
.attr("stop-color", d => colorScheme(d.target.id));
.append('stop')
.attr('offset', '100%')
.attr('stop-color', (d) => colorScheme(d.target.id));
link
.append('path')

View File

@ -7,7 +7,6 @@ const prepareTextForParsing = (text: string): string => {
return textToParse;
};
class Uid {
private static count = 0;
id: string;
@ -23,16 +22,8 @@ class Uid {
}
toString(): string {
return "url(" + this.href + ")";
return 'url(' + this.href + ')';
}
}
export {
Uid,
prepareTextForParsing
};
export { Uid, prepareTextForParsing };