fcor / arjs-gestures

Rotate and zoom with touch gestures on any Image tracking or Marker Based AR.js scene
MIT License
162 stars 97 forks source link

Can this work with the location-based method? #15

Open ediejm opened 3 years ago

ediejm commented 3 years ago

Not really an issue just a question! This is super cool and I am excited to have come across it, it works really well. Thank you!

I did try applying it to a location-based object (i.e. no marker) and it doesn't work with that. I know you've not suggested that it should, but I wondered if there's any way to make it work with location-based or would that be impossible?

fcor commented 3 years ago

Hi! Sorry for my late response, did you try it with location based? I haven't used it there but I think It should work since the transformations are applied at a-scene level.

AdamVI2 commented 2 years ago

Actually it didn't work for me by default in case of location based. Both functions: handleRotation and handleScale require an object to be visible (this.visible), while visibility is (by default) set only with markerFound listeners (and those are not being triggered obviously in case of location based).

I would suggest adding to registerComponent("gesture-handler") schema:

locationBased: { default: false},

and then alternating init: function() line:

this.isVisible = false;

to

this.isVisible = this.data.locationBased;

With that setup we can use

gesture-handler="locationBased: true"

in our object's options. At least I did that and it worked fo me :) Hope this helps!

fcor commented 2 years ago

Nice! Feel free to create a PR :)