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

Only a single Canvas on a page supported? #10

Open
Zigby opened this issue Jan 7, 2023 · 1 comment
Open

Only a single Canvas on a page supported? #10

Zigby opened this issue Jan 7, 2023 · 1 comment

Comments

@Zigby
Copy link

Zigby commented Jan 7, 2023

I was moving from the using Blazor.Extensions.Blazor to this one and enjoy the library but stumbled upon a problem. When I add more than one canvas it seems drawing ends up in one and the same canvas.
Except for having multiple canvases at different positions, it is also very useful with layers having different z order for two canvases.

This is the layout. Drawing in Canvas1 actually ends up in Canvas 2.

<div class="canvas1">
    <BlazorCanvas @ref="Canvas1">
        <canvas width="@Width" height="@Height"></canvas>
    </BlazorCanvas>
</div>
<div class="canvas2">
    <BlazorCanvas @ref="Canvas2">
        <canvas width="@Width" height="@Height"></canvas>
    </BlazorCanvas>
</div>

<style>
    .canvas1 {
        position: relative;
        top: 8px;
        width: 100%;
        height: 600px;
        left: 0
    }

    .canvas2 {
        position: relative;
        top: 608px;
        width: 100%;
        left: 0
    }
</style>

image

@kuhnboy
Copy link

kuhnboy commented Mar 14, 2024

Looks like that is the case:

export function canvas_register(divElement) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants