That is the thing, i'm creating a shape that covers all canvas to act like a white background, i have a transformer and im listening to canvas clicks, inside it im adding objects into transformer nodes, but i don't like to transform the white shape that im using as a background.
Asked
Active
Viewed 31 times
1 Answers
0
Just don't add transformer into it. I see several solutions:
- Set
listening = false
on that background shape. In that case, it will not trigger any mouse/touch/pointer events - Or set a special name for it in just ignore in
click
callback
const background = new Konva.Rect({
fill: 'white',
width: stage.width(),
height: stage.height(),
name: 'nonSelectable'
});
stage.on('click', (e) => {
// ignore such shape
if (e.target.hasName('nonSelectable')) {
return;
}
// else attach transformer
});

lavrton
- 18,973
- 4
- 30
- 63