thedankvank
thedankvank

Reputation: 1

Konva Layer not working with onClick() only in ReactJS

I want to make it so that clicking on the contents of a particular stage change the state of a variable.

This works when I move the onClick={} to Stage but doesn't work with the Layer. What could be causing this? This seems to work with the html version of Konva

Upvotes: 0

Views: 127

Answers (1)

lavrton
lavrton

Reputation: 20308

Every event of the layer starts from a shape. Clicking on empty space will not trigger any events on the layer.

For Stage it works differently. The stage will fire events when you click on empty areas.

Upvotes: 1

Related Questions