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
project hitTest should return all results #536
Comments
I have the same problem. I have several paths of one kind, each of them hits the same items of another kind. All of the paths of the first kind return the same item of the second kind on a hitTest. Is there any way to get all items which have been hit? |
I did similar thing as workaround. |
I will have to implement this. The workaround works, but is very inefficient, computing-wise. There is an internal requirement for similar functionality for an upcoming refactoring / improvement of how mouse events are handled, and I'll include this there. Keeping the bug open for the time being. |
+1 for events propagating down and hitTest returning array refactor, I was also forced to use them ugly workarounds :/, these events are a highly limiting factor right now. |
Hi. Solving this issue would be nice improvement |
👍 |
+1 Maybe another workaround is to use |
@piotrwitek I just realized that events propagating and But I will implement a way to get multiple hit-results in one call. It will not be through |
@lehni thanks for your time looking into this issue, this was some time ago, but I'm sure what I meant here was related to only one point, to get multiple hit-result in one call, and probably I didn't express myself clear enough describing it. |
So I've been thinking about how to implement this in
This means:
If this is too complicated, we can consider a second version, for example
It could also be named Thoughts? |
@lehni I think both of your proposal would be useful to add into paper.js, but in my opinion they serve different purposes, and first solution is kinda hackish when you'd like to solve the problem of returning all hitTest items. First solution would be useful to bring the possibility to integrate custom or some intricate selection logic in hitTest calls, that would not fit into the standard Second proposal is a fitting solution for discussed problem, though I like |
Thanks for the feedback! I think I prefer 'All', because it returns all hits in that location, not just multiples. |
Thinking again I agree with you, "hit test all" of them seems better. Pozdrawiam, 2016-02-14 10:46 GMT+01:00 Jürg Lehni notifications@github.com:
|
Finally done :) |
It appears that hitTestAll is not available as a function on any item that I have attempted to call it on... Is something broken? My goal was to target multiple class items, but only one class can be specified in the options config. I tried adding a match function, but it never gets called... UPDATE: I just globally scoped my project and checked the available methods for "hit", and "hitTest" is the only available one. Thus, something isn't getting properly injected, or the documentation isn't up to date. After reviewing the Git source, it looks like it's injected... But it does not appear to be in my project... |
You need a |
Ok, so I have pulled / replaced my master file with the current script located here: https://raw.githubusercontent.com/paperjs/paper.js/prebuilt/module/dist/paper-core.js Still, the only available "hit" method on the project is "hitTest", nothing more... |
I'd be happy to start a Google Hangout and shoot you an invite so that you can see what I am doing if you'd like? To say that I am 100% sure would be wrong, I can only relay what I am seeing in my own project... |
Sounds like a caching issue then... Make sure the new file is actually loaded in your browser. I am on the road right now, not available for hangout. |
I assumed that too, I did a "Empty Cache and Hard Reload" in Chrome just to be sure, with the same result. Honestly it's not a huge deal as I can work around it... Just wanted to bring it to your attention. |
Well, it's present here, so I am pretty sure you must be somehow using the wrong version... What do you see when you log this: console.log(project.hitTestAll); or console.log(paper.Project.prototype.hitTestAll); |
HitResult contains information about one item of the all possibles. It would be great the all, for example hitResult.items array
The text was updated successfully, but these errors were encountered: