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

Using hitTest with options.match never returns a result #2078

Open
pearcetm opened this issue May 20, 2024 · 1 comment
Open

Using hitTest with options.match never returns a result #2078

pearcetm opened this issue May 20, 2024 · 1 comment

Comments

@pearcetm
Copy link

Description/Steps to reproduce

Try performing hit testing using hitTest(point, {match: item=>true}) - nothing ever matches, even though the match function returns true.

Link to reproduction test-case

http://sketch.paperjs.org/#V/0.12.17/S/lVRNi9swEP0rIpfI4DjekMKSZQtLoD0Flm5KD00Piq3EamRJyOO0S8h/78iyEqd2DquDQKOZ9+b7NFKs5KPF6O3AIStG8SjTuXsfmSWggcm3ghlOnonif8hSl0bXKn9lUNDoiUynyTeeAVN7yalTuL5maRqT5pq3VxQ9bdRG7WqVgdCKaLXSdcW/G8qPXEFEThtF8Pjb8SPiUthMBnpHm3iJt0kkq+BVCwWOweE704tZUoHVB/5D5FAgxOzO/1JLbfF/vJUsO4x7WjshZdBRtZR9GCMFvAB9CB745L3kuXc8qNVbsCwDes1rTE5CVdzCgoCt8ekU+GLHZMXPAc3fN8W4PhLLDbqNQWJJOuJaCWhq4smjANZR6cY1NkJdQu/oaMMyAe+okSafeoFbXuojpwG74rAWJdc1UBo9fx6GiclDis3gLabTuw7tLecqeHSrt7VC7df6i9UKqO+qjToPNdfKuefbq+2uTKtKo+tS76lBMJsYq39j2yaFgDWvoO0s47vqVDIciwXmssSAsETnKGq5JAeyt7o2bXd6tK9OQk/MGPm+YmDF3041N6oxSMrmI6ky5ibF/dyTd93t6WAWomBqdCWayLvONKNBH9P4MR0GC1aRD8diHm4B3MTdjngXedbMeBT3KOdpPPcD73lYni8LIXPqGJwYCxoIZx9hnDjKySDnBEknLSvCDxB3Mt3fDF15fyP434FNcGH6aAGcQxej+D+Q8G6LjVtBVZI1lcIVvbWcHZoGrUaLn7/O/wA=

Expected result

Items should be found by the hit test and not filtered out, as described in the documentation:

options.match: Function — a match function to be called for each found hit result: Return true to return the result, false to keep searching

@pearcetm
Copy link
Author

It looks like what is happening here is that when any option is set, it unsets the default values including fill: true, stroke: true, etc. Because of this, it doesn't hit test against any of these components, so it always returns false.

I'm not sure if this is the intended behavior - the documentation doesn't really indicate that you have to explicitly re-enable the components you want to test - but adding these into the options object should make it work correctly as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant