Open
Conversation
if the entity is added dynamically while its marker is visible to the camera the handler will not fire as isVisible is false. so you have to remove the camera from the marker (markerLost) then scan the marker again (markerFound) so that the events fire again and you are able to rotate and scale.
to circumvent it I copied isVisible from the parent marker data attributes. so if the user wants to add dynamic content and circumvent this events not firing on first scan he should add:
```
AFRAME.registerComponent('markerhandler', {
init: function () {
this.el.sceneEl.addEventListener('markerLost', (e) => {
e.target.dataset.isVisible = '0';
});
this.el.sceneEl.addEventListener('markerFound', (e) => {
e.targetdataset.isVisible = '1';
});
}
});
```
and on the marker:
```
<a-marker markerhandler ...> ... </a-marker>
```
Owner
|
Hey! Thanks for contributing :) I'm wondering if "markerhandler" component should be part of the tool in order for this to work on every use case. Have you tried adding |
Author
|
@fcor no I havent. Ill give it a try and get back to you. thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
if the entity is added dynamically while its marker is visible to the camera the handler will not fire as isVisible is false. so you have to remove the camera from the marker (markerLost) then scan the marker again (markerFound) so that the events fire again and you are able to rotate and scale.
to circumvent it I copied isVisible from the parent marker data attributes. so if the user wants to add dynamic content and circumvent this events not firing on first scan he should add:
and on the marker: