a-frame-components
Advanced tools
Comparing version 1.0.45 to 1.0.46
@@ -102,2 +102,3 @@ var __assign = (this && this.__assign) || function () { | ||
me.renderCheck(data); | ||
me.updateElementSize(me, me.el); | ||
}, setButtonEvents: function (_a) { | ||
@@ -193,4 +194,4 @@ var el = _a.el, background = _a.background, data = _a.data, guiItem = _a.guiItem; | ||
}, update: function (oldData) { | ||
var me = this; | ||
var data = this.data; | ||
var el = this.el; | ||
this.renderCheck(data); | ||
@@ -209,2 +210,3 @@ if (this.data.show !== oldData.show) { | ||
} | ||
me.updateElementSize(me, me.el); | ||
}, setText: function (newText) { | ||
@@ -211,0 +213,0 @@ var data = this.data; |
@@ -8,2 +8,24 @@ export default { | ||
}, | ||
updateElementSize: function updateElementSize(container, el) { | ||
var change = false; | ||
var currentWidth = el.getAttribute('width'); | ||
var newWidth = container.getWidth().toString(); | ||
if (currentWidth !== newWidth) { | ||
el.setAttribute('width', newWidth); | ||
change = true; | ||
} | ||
var currentHeight = el.getAttribute('height'); | ||
var newHeight = container.getHeight().toString(); | ||
if (currentHeight !== newHeight) { | ||
el.setAttribute('height', newHeight); | ||
change = true; | ||
} | ||
// Emit event only if there was any change | ||
if (change) { | ||
el.emit('size-update', { | ||
width: newWidth, | ||
height: newHeight, | ||
}); | ||
} | ||
} | ||
}; |
@@ -88,2 +88,3 @@ var __assign = (this && this.__assign) || function () { | ||
me.updateChecked(); | ||
me.updateElementSize(me.radioContainer, me.el); | ||
} | ||
@@ -103,3 +104,3 @@ } | ||
defaultComponents: { | ||
'radio-component': {} | ||
'radio-component': {}, | ||
}, | ||
@@ -106,0 +107,0 @@ mappings: { |
{ | ||
"name": "a-frame-components", | ||
"version": "1.0.45", | ||
"version": "1.0.46", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -98,2 +98,3 @@ import { AFRAME } from "../../react/root"; | ||
me.renderCheck(data); | ||
me.updateElementSize(me, me.el); | ||
@@ -205,4 +206,4 @@ }, | ||
update: function (oldData) { | ||
let me = this; | ||
var data = this.data; | ||
var el = this.el; | ||
this.renderCheck(data) | ||
@@ -224,2 +225,3 @@ if (this.data.show !== oldData.show) { | ||
} | ||
me.updateElementSize(me, me.el); | ||
}, | ||
@@ -226,0 +228,0 @@ setText: function (newText) { |
@@ -8,2 +8,28 @@ export default { | ||
}, | ||
updateElementSize: function updateElementSize(container, el) { | ||
let change = false; | ||
const currentWidth = el.getAttribute('width'); | ||
const newWidth = container.getWidth().toString(); | ||
if (currentWidth !== newWidth) { | ||
el.setAttribute('width', newWidth); | ||
change = true; | ||
} | ||
const currentHeight = el.getAttribute('height'); | ||
const newHeight = container.getHeight().toString(); | ||
if (currentHeight !== newHeight) { | ||
el.setAttribute('height', newHeight); | ||
change = true; | ||
} | ||
// Emit event only if there was any change | ||
if (change) { | ||
el.emit('size-update', { | ||
width: newWidth, | ||
height: newHeight, | ||
}); | ||
} | ||
} | ||
} |
@@ -82,2 +82,3 @@ import { AFRAME } from "../../react/root"; | ||
me.updateChecked(); | ||
me.updateElementSize(me.radioContainer, me.el); | ||
} | ||
@@ -98,3 +99,3 @@ } | ||
defaultComponents: { | ||
'radio-component': {} | ||
'radio-component': {}, | ||
}, | ||
@@ -101,0 +102,0 @@ mappings: { |
1660467
28248