Мой компонент предназначен для создания новой сущности при проверке, что он делает, и добавляет большинство атрибутов, но не вращение и положение. Я вижу, что это проблема с версиями до 0.5.0, но я использую 0.8.0, и он все еще не обновляется. Есть идеи?
AFRAME.registerComponent('new-room', {
schema: {
on: {type: 'string'},
rotation: {type: 'string'},
target: {type: 'selector'},
iconposition: {type: 'string'},
iconrotation: {type: 'string'}
},
init: function () {
// Do something when component first attached.
var data = this.data;
var el = this.el;
el.addEventListener(data.on, function () {
// Set image.
data.target.setAttribute('rotation', data.rotation);
// Remove all room icons
var entityEl = document.querySelector('.icons');
entityEl.parentNode.removeChild(entityEl);
// Adjust room icons
var entityEl = document.createElement('a-entity');
document.querySelector('a-scene').appendChild(entityEl);
entityEl.setAttribute('geometry', {primitive: 'plane', height: '1', width: '1'});
entityEl.setAttribute('material', {shader: 'flat', src: '#thumb', transparent: 'true', opacity: '.3'});
entityEl.setAttribute('class','icons');
entityEl.setAttribute('position',data.iconposition);
document.querySelector('a-scene').flushToDOM(true);
});
}
});