Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 4x | import Sigma from "../classes/Sigma";
/**
* This middleware will just copy the graphic properties.
*
* @param {?string} readPrefix The read prefix.
* @param {?string} writePrefix The write prefix.
*/
export default function copy(
this: Sigma,
readPrefix: string,
writePrefix: string
) {
if (`${writePrefix}` === `${readPrefix}`) return;
this.graph.nodes().forEach(node => {
node[`${writePrefix}x`] = node[`${readPrefix}x`];
node[`${writePrefix}y`] = node[`${readPrefix}y`];
node[`${writePrefix}size`] = node[`${readPrefix}size`];
});
this.graph.edges().forEach(edge => {
edge[`${writePrefix}size`] = edge[`${readPrefix}size`];
});
}
|