Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Threlte stopPropagation on click event

$
0
0

Using Threlte i can create two shapes in a file like so :

<T.Mesh on:click={(e) => console.log("little shape") } ></T.Mesh><T.Mesh on:click={(e) => console.log("bigger shape") } ></T.Mesh>

In order to avoid the second shape to tigger it's event on a click on the small one, I can add e.stopPropagation() like so :

<T.Mesh on:click={(e) => {console.log("little shape"); e.stopPropagation() }}></T.Mesh>

Issue comes when I wants to create a separate component out of my little shape. stopping propagation inside the other file is pointless, and stopImmediatePropagation() isn't recognized as a function.

App.svelte
<LittleShape  on:click >>/LittleShape><T.Mesh   on:click={(e) => {console.log("bigger shape") }} ></T.Mesh>
LittleShape.svelte
<T.Mesh></T.Mesh>

How can I split my file while preventing propagation

Thanks in advance!


Viewing all articles
Browse latest Browse all 1541

Trending Articles