Skip to content

Commit ab55449

Browse files
authored
refactor: check that the plugin is available prior setting properties (#229)
In the next maxGraph version, `Abstract.getPlugin` may return `undefined`, so a TSC error is thrown if the code doesn't verify that the plugin is present.
1 parent 2caf818 commit ab55449

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

projects/_shared/src/generate-graph.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ export const initializeGraph = (container?: HTMLElement) => {
6464
graph.setPanning(true); // Use mouse right button for panning
6565

6666
// Customize the rubber band selection
67-
graph.getPlugin<RubberBandHandler>('RubberBandHandler').fadeOut = true;
67+
const rubberBandHandler = graph.getPlugin<RubberBandHandler>('RubberBandHandler');
68+
rubberBandHandler && (rubberBandHandler.fadeOut = true);
6869

6970
// create a dedicated style for "ellipse" to share properties
7071
graph.getStylesheet().putCellStyle('myEllipse', {

0 commit comments

Comments
 (0)