a-frame-components
Advanced tools
Comparing version 1.0.329 to 1.0.330
@@ -82,2 +82,3 @@ var __assign = (this && this.__assign) || function () { | ||
me.visibleObjects = {}; | ||
me.visibleItemObjects = {}; | ||
var options = me.getOptions(); | ||
@@ -221,2 +222,3 @@ me.options = options; | ||
} }), InteractionMixin), { update: function (oldData) { | ||
var _a, _b, _c, _d; | ||
var me = this; | ||
@@ -229,11 +231,19 @@ if (JSON.stringify(this.data.options) !== JSON.stringify(oldData.options || '')) { | ||
var key = parseInt(keys[k]); | ||
var vo = me.visibleObjects[key]; | ||
try { | ||
if (vo === null || vo === void 0 ? void 0 : vo.parentNode) | ||
vo.parentNode.removeChild(vo); | ||
if (!((_a = me === null || me === void 0 ? void 0 : me.data) === null || _a === void 0 ? void 0 : _a.itemtemplate)) { | ||
var vo = me.visibleObjects[key]; | ||
try { | ||
if (vo === null || vo === void 0 ? void 0 : vo.parentNode) | ||
vo.parentNode.removeChild(vo); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
delete me.visibleObjects[key]; | ||
delete me.visibleItemObjects[key]; | ||
} | ||
catch (e) { | ||
console.log(e); | ||
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 }))); | ||
} | ||
} | ||
delete me.visibleObjects[key]; | ||
} | ||
@@ -347,7 +357,9 @@ } | ||
delete me.visibleObjects[key]; | ||
delete me.visibleItemObjects[key]; | ||
}); | ||
to_add.forEach(function (option) { | ||
var entity = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id).entity; | ||
var _a = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id), entity = _a.entity, item = _a.item, opt = _a.option; | ||
me.sprocket.appendChild(entity); | ||
me.visibleObjects[option.id] = entity; | ||
me.visibleItemObjects[option.id] = { item: item, option: opt }; | ||
}); | ||
@@ -397,3 +409,7 @@ // console.log(`me.currentIndexScroll: ${me.currentIndexScroll}`) | ||
entity_1.appendChild(item); | ||
return { entity: entity_1 }; | ||
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 }) | ||
}; | ||
} | ||
@@ -400,0 +416,0 @@ var entity = document.createElement('a-entity'); |
{ | ||
"name": "a-frame-components", | ||
"version": "1.0.329", | ||
"version": "1.0.330", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -81,2 +81,3 @@ import { AFRAME } from '../systems/brush'; | ||
me.visibleObjects = {}; | ||
me.visibleItemObjects = {}; | ||
let options = me.getOptions(); | ||
@@ -239,8 +240,22 @@ me.options = options; | ||
let key = parseInt(keys[k]); | ||
let vo = me.visibleObjects[key]; | ||
try { | ||
if (vo?.parentNode) | ||
vo.parentNode.removeChild(vo); | ||
} catch (e) { console.log(e) } | ||
delete me.visibleObjects[key] | ||
if (!me?.data?.itemtemplate) { | ||
let vo = me.visibleObjects[key]; | ||
try { | ||
if (vo?.parentNode) | ||
vo.parentNode.removeChild(vo); | ||
} catch (e) { console.log(e) } | ||
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, | ||
})); | ||
} | ||
} | ||
} | ||
@@ -354,7 +369,9 @@ } | ||
delete me.visibleObjects[key] | ||
delete me.visibleItemObjects[key] | ||
}); | ||
to_add.forEach((option: { id: number, value: number, text: string }) => { | ||
let { entity } = me.createOptionEl(option, (Math.PI / me.visible_items / 2) * option.id); | ||
let { entity, item, option: opt } = 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 }; | ||
}) | ||
@@ -413,3 +430,14 @@ // console.log(`me.currentIndexScroll: ${me.currentIndexScroll}`) | ||
entity.appendChild(item); | ||
return { entity }; | ||
return { | ||
entity, item, option: { | ||
...options, | ||
imageMargin: me.imageMargin, | ||
selectionevent: me.data.selectionevent, | ||
guiItem: me.guiItem, | ||
value, | ||
id, | ||
text, | ||
url, | ||
} | ||
}; | ||
} | ||
@@ -416,0 +444,0 @@ let entity: any = document.createElement('a-entity'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1788738
30559