himanshu archirayan
himanshu archirayan

Reputation: 223

Select another object should fire `before:selection:cleared` event

Here is my issue: When you select an object and then click on a white space, before:selection:clearedevent is correctly fired.

But when you select an object and then click on another object, this event is not fired (and so selection:cleared).

I guess it's not a bug, but shouldn't canvas fire selection:cleared event whenever it loses focus ?

The thing is that there is no other way (or I'm missing something) to get previous selected object if before:selection:cleared event is not fired when selecting another object, and that's a problem if you want to update selected object before he loses focus.

Upvotes: 0

Views: 207

Answers (1)

Soufiane Hassou
Soufiane Hassou

Reputation: 17750

Use a variable to store the currently selected object (Every time object:selected is fired).

When object:selected is fired the first time, your variable will be uninitialized, giving you the ability to know if it's the first selected object or not.

Upvotes: 2

Related Questions