mnannola / ember-cli-aframe

Ember Addon for the A-Frame WebVR framework
https://mnannola.github.io/ember-cli-aframe/
MIT License
3 stars 1 forks source link

Click handling #3

Closed lukegalea closed 8 years ago

lukegalea commented 8 years ago

It looks like ember's approach where a single click handler is registered at the document level doesn't work with a-frame.

Do you know of a good solution for handling events in ember with a-frame?

This doesn't work:

{{ember-a-box onclick=(action 'clicked')}

This works:

document.querySelector('a-sphere').addEventListener('click', function () {
  this.setAttribute('material', 'color', 'blue');
  console.log('I was clicked!');
});
lukegalea commented 8 years ago

Okay - I sorted it out (kinda).

onclick doesn't work, but implementing click inside a component does. I can work around it by implementing click in your ember-a-xxx components and having it call a closure action.