Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a Zoom/Scroll aware Grid #317

Open
rsoika opened this issue Dec 27, 2023 · 0 comments
Open

Implement a Zoom/Scroll aware Grid #317

rsoika opened this issue Dec 27, 2023 · 0 comments
Labels
feature GLSP Core Good for newcomers

Comments

@rsoika
Copy link
Member

rsoika commented Dec 27, 2023

See discussion #316 :

Peek 2023-12-27 14-25

@injectable()
export class BPMNGraphView implements IView {
    @inject(EdgeRouterRegistry) edgeRouterRegistry: EdgeRouterRegistry;

    render(model: Readonly<SGraphImpl>, context: RenderingContext): VNode {
        const edgeRouting = this.edgeRouterRegistry.routeAllChildren(model);

        const gridBounds: Bounds = {
            x: model.scroll.x,
            y: model.scroll.y,
            width: Math.max(10, model.canvasBounds.width / model.zoom),
            height: Math.max(10, model.canvasBounds.height / model.zoom)
        };

        const transform = `scale(${model.zoom}) translate(${-model.scroll.x},${-model.scroll.y})`;
        return (
            <svg class-sprotty-graph={true}>
                <defs>
                    <pattern id='bpmn-grid-pattern' x='-5' y='-5' width='10' height='10' patternUnits='userSpaceOnUse'>
                        <line x1="0" y1="5" x2="10" y2="5" class-bpmn-grid-line={true} />
                        <line x1="5" y1="0" x2="5" y2="10" class-bpmn-grid-line={true} />
                    </pattern>
                </defs>
                <g transform={transform}>
                    <rect
                        x={gridBounds.x}
                        y={gridBounds.y}
                        width={gridBounds.width}
                        height={gridBounds.height}
                        fill='url(#bpmn-grid-pattern)'
                    />
                    <g class-graph-content={true}>{context.renderChildren(model, { edgeRouting })}</g>
                </g>
            </svg>
        );
    }
}

There seems to be still an issue with loading new diagrams. Also the usage of the edgeRouterRegistry is unclear.....

@rsoika rsoika added GLSP Core Good for newcomers feature labels Dec 27, 2023
rsoika added a commit that referenced this issue Jan 19, 2024
Issue #317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature GLSP Core Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant