diff --git a/examples/x6-example-features/src/pages/stencil/index.tsx b/examples/x6-example-features/src/pages/stencil/index.tsx index 50443b212f2..460816c74a6 100644 --- a/examples/x6-example-features/src/pages/stencil/index.tsx +++ b/examples/x6-example-features/src/pages/stencil/index.tsx @@ -111,6 +111,8 @@ export default class Example extends React.Component { stencil.load([r, c, c2, r2.clone()], 'group1') stencil.load([c2.clone(), r2, r3, c3], 'group2') + stencil.addGroup({ name: 'group3' }) + stencil.load([c2.clone()], 'group3') } refContainer = (container: HTMLDivElement) => { diff --git a/packages/x6-plugin-stencil/src/index.ts b/packages/x6-plugin-stencil/src/index.ts index 4c2b11f25b3..9ef9c1837e1 100644 --- a/packages/x6-plugin-stencil/src/index.ts +++ b/packages/x6-plugin-stencil/src/index.ts @@ -169,7 +169,11 @@ export class Stencil extends View implements Graph.Plugin { } else { this.options.groups = groups } - groups.forEach((group) => this.initGroup(group)) + groups.forEach((group) => { + this.initGroup(group) + const graph = this.graphs[group.name] + graph.on('cell:mousedown', this.onDragStart, this) + }) } removeGroup(groupName: string | string[]) {