This is potentially a bug, but more likely this I’m just missing the mark.
I’m attempting to implement the library by extending each of the classes as appropriate to build out the diagram parts in a clean reusable way.
My issue is specifically when I extend the Link class, it doesn’t seem to respect that the child shapes should only have its styles inherited, not actually render it. This is where I’m probably missing something.
Extended Shape
import go from 'gojs';
import theme from '@pkg/mui-theme';
export default class Shape extends go.Shape {
constructor() {
super();
this.strokeWidth = 2;
this.stroke = theme.palette.primary.main;
}
}
Extended Link (objective)
import go from 'gojs';
import Menu from './Menu';
import Shape from './Shape';
export default class Link extends go.Link {
constructor(context) {
super();
this.name = 'Link';
this.corner = 2;
this.contextMenu = new Menu(context);
this.routing = go.Link.Orthogonal;
this.selectionAdorned = false;
this.add(new Shape());
}
}
Working alternative
// inside Diagram.constructor()
const link = new go.Link();
link.corner = 2;
link.contextMenu = new Menu(contexts.link);
link.routing = go.Link.Orthogonal;
link.selectionAdorned = false;
link.add(new Shape());
this.linkTemplate = link;
The below is what happens when I use the extended version: