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

onSelect called when the object is not selected. #5596

Closed
rpFilipe opened this issue Mar 27, 2019 · 4 comments · Fixed by #5632
Closed

onSelect called when the object is not selected. #5596

rpFilipe opened this issue Mar 27, 2019 · 4 comments · Fixed by #5632
Labels

Comments

@rpFilipe
Copy link
Contributor

rpFilipe commented Mar 27, 2019

Version

2.6.0

Test Case

http://jsfiddle.net/rpfilipe/rjx23sek/4/

Information about environment

Chrome, FIrefox

Steps to reproduce

Perform a selection by dragging the mouse that doesn't intersect the object.

Expected Behavior

onSelect() should not be called.

Actual Behavior

onSelect() is caled

Where's the problem

The onSelect() is called in the __collectObjects() method.

On the docs is stated that "This callback function is called every time _discardActiveObject or _setActiveObject try to to select this object".

Full Call Stack
__collectObjects() : fabric.js:12024
_groupSelectedObjects(): fabric.js:12015
_maybeGroupObjects(): fabric.js:12074
__onMouseUp(): fabric.js:11290
_onMouseUp(); fabric.js:11187

@asturur
Copy link
Member

asturur commented Mar 29, 2019

i think the doc needs to be updated.
That function is called everytime something (that is not under direct dev control) tries to select the object and you want to intervene before this happens.

@asturur
Copy link
Member

asturur commented Mar 29, 2019

oh well i see your point. is called too much there. a bug.

@asturur asturur added the bug label Mar 29, 2019
@rpFilipe
Copy link
Contributor Author

Okay, I understand now. Maybe we should move the calling of the onSelect after we determine whether the object is in the area of the selection?

@rpFilipe
Copy link
Contributor Author

Created a PR that fixes this problem. #5632

rpFilipe added a commit to rpFilipe/fabric.js that referenced this issue Apr 10, 2019
rpFilipe added a commit to rpFilipe/fabric.js that referenced this issue Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants