a-frame-components
Advanced tools
Comparing version 1.0.330 to 1.0.331
@@ -82,3 +82,2 @@ var __assign = (this && this.__assign) || function () { | ||
me.visibleObjects = {}; | ||
me.visibleItemObjects = {}; | ||
var options = me.getOptions(); | ||
@@ -222,3 +221,3 @@ me.options = options; | ||
} }), InteractionMixin), { update: function (oldData) { | ||
var _a, _b, _c, _d; | ||
var _a, _b; | ||
var me = this; | ||
@@ -231,3 +230,3 @@ if (JSON.stringify(this.data.options) !== JSON.stringify(oldData.options || '')) { | ||
var key = parseInt(keys[k]); | ||
if (!((_a = me === null || me === void 0 ? void 0 : me.data) === null || _a === void 0 ? void 0 : _a.itemtemplate)) { | ||
if (JSON.stringify((_a = this.data.options) === null || _a === void 0 ? void 0 : _a[key]) !== JSON.stringify(((_b = oldData.options) === null || _b === void 0 ? void 0 : _b[key]) || '')) { | ||
var vo = me.visibleObjects[key]; | ||
@@ -242,9 +241,3 @@ try { | ||
delete me.visibleObjects[key]; | ||
delete me.visibleItemObjects[key]; | ||
} | ||
else { | ||
if ((_b = me.visibleItemObjects[key]) === null || _b === void 0 ? void 0 : _b.item) { | ||
(_c = me.visibleItemObjects[key]) === null || _c === void 0 ? void 0 : _c.item.setAttribute('options', JSON.stringify(__assign(__assign(__assign({}, (_d = me.visibleItemObjects[key]) === null || _d === void 0 ? void 0 : _d.option), options), { imageMargin: me.imageMargin, selectionevent: me.data.selectionevent, guiItem: me.guiItem }))); | ||
} | ||
} | ||
} | ||
@@ -358,9 +351,7 @@ } | ||
delete me.visibleObjects[key]; | ||
delete me.visibleItemObjects[key]; | ||
}); | ||
to_add.forEach(function (option) { | ||
var _a = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id), entity = _a.entity, item = _a.item, opt = _a.option; | ||
var entity = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id).entity; | ||
me.sprocket.appendChild(entity); | ||
me.visibleObjects[option.id] = entity; | ||
me.visibleItemObjects[option.id] = { item: item, option: opt }; | ||
}); | ||
@@ -410,7 +401,3 @@ // console.log(`me.currentIndexScroll: ${me.currentIndexScroll}`) | ||
entity_1.appendChild(item); | ||
return { | ||
entity: entity_1, | ||
item: item, | ||
option: __assign(__assign({}, options), { imageMargin: me.imageMargin, selectionevent: me.data.selectionevent, guiItem: me.guiItem, value: value, id: id, text: text, url: url }) | ||
}; | ||
return { entity: entity_1 }; | ||
} | ||
@@ -417,0 +404,0 @@ var entity = document.createElement('a-entity'); |
{ | ||
"name": "a-frame-components", | ||
"version": "1.0.330", | ||
"version": "1.0.331", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -81,3 +81,2 @@ import { AFRAME } from '../systems/brush'; | ||
me.visibleObjects = {}; | ||
me.visibleItemObjects = {}; | ||
let options = me.getOptions(); | ||
@@ -240,3 +239,3 @@ me.options = options; | ||
let key = parseInt(keys[k]); | ||
if (!me?.data?.itemtemplate) { | ||
if (JSON.stringify(this.data.options?.[key]) !== JSON.stringify(oldData.options?.[key] || '')) { | ||
let vo = me.visibleObjects[key]; | ||
@@ -248,15 +247,3 @@ try { | ||
delete me.visibleObjects[key] | ||
delete me.visibleItemObjects[key] | ||
} | ||
else { | ||
if (me.visibleItemObjects[key]?.item) { | ||
me.visibleItemObjects[key]?.item.setAttribute('options', JSON.stringify({ | ||
...me.visibleItemObjects[key]?.option, | ||
...options, | ||
imageMargin: me.imageMargin, | ||
selectionevent: me.data.selectionevent, | ||
guiItem: me.guiItem, | ||
})); | ||
} | ||
} | ||
} | ||
@@ -370,9 +357,7 @@ } | ||
delete me.visibleObjects[key] | ||
delete me.visibleItemObjects[key] | ||
}); | ||
to_add.forEach((option: { id: number, value: number, text: string }) => { | ||
let { entity, item, option: opt } = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id); | ||
let { entity } = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id); | ||
me.sprocket.appendChild(entity); | ||
me.visibleObjects[option.id] = entity; | ||
me.visibleItemObjects[option.id] = { item, option: opt }; | ||
}) | ||
@@ -431,14 +416,3 @@ // console.log(`me.currentIndexScroll: ${me.currentIndexScroll}`) | ||
entity.appendChild(item); | ||
return { | ||
entity, item, option: { | ||
...options, | ||
imageMargin: me.imageMargin, | ||
selectionevent: me.data.selectionevent, | ||
guiItem: me.guiItem, | ||
value, | ||
id, | ||
text, | ||
url, | ||
} | ||
}; | ||
return { entity }; | ||
} | ||
@@ -445,0 +419,0 @@ let entity: any = document.createElement('a-entity'); |
1786527
30519