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

Clip on group not working with width: 0 and height: 0 #1723

Closed
matkokvesic opened this issue Feb 19, 2024 · 1 comment
Closed

Clip on group not working with width: 0 and height: 0 #1723

matkokvesic opened this issue Feb 19, 2024 · 1 comment

Comments

@matkokvesic
Copy link

matkokvesic commented Feb 19, 2024

Clip group with child elements should not show anything with following attrs:

let widthValue = 0;
let heightValue = 0;
group.setAttrs({
  clip: {
    x: 0,
    y: 0,
    width: widthValue,
    height: heightValue,
  },
});

https://codesandbox.io/p/sandbox/konva-playground-forked-c2x4hl

Seems like clip attrs are ignored if width and height are 0.

Alternative is to use corresponding clipFunc:

let widthValue = 0;
let heightValue = 0;
group.clipFunc((ctx) => {
        ctx.rect(0, 0, widthValue, heightValue)
      });
@lavrton lavrton closed this as completed in eb4e2b4 Mar 3, 2024
@lavrton
Copy link
Member

lavrton commented Mar 3, 2024

Released a fix.

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