Added custom found/lost events to markerControls for three.js core #225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Feature: Added custom
markerFoundandmarkerLostevents to markerControls in three.js coreHow can we test it?
On any three.js + ar.js app, using markers (Pattern or Barcode) add this listeners and you should see events triggered specifying which marker was found/lost.
Summary
I needed to trigger some stuff based on markers visibility and found that Three.js core didn't have this custom events as A-Frame Core has.
Explored different approaches and found that this was the simpler one, since it does not require to change anything on artoolkit api when processing the frame. Visibility check is done after frame is fully processed (confidence tests are already done).
Does this PR introduce a breaking change?
No.
Please TEST your PR before proposing it. Specify here what device you have used for tests, version of OS and version of Browser
Tested with a three.js + ar.js app with 12 pattern markers in the following browsers:
Other information
Not sure if I have to run the make/build command as part of the PR, please let me know. Also if you need a sample app or some help for running tests just let me know.
Added markerControl complete object to event detail, not sure if we want to pass all this info or just some parts of it, like the patternUrl or ID etc.