Closed akevalion closed 3 years ago
I can update the code about the popUp and now this can change the size dependending the lenght text. add image and code.
if (txtInfo != null) {
var value = 'value: ' + txtInfo + '; color: #FFF; anchor: center; align: center; width: 1.2';
totalWidth = Math.trunc(txtInfo.length / 10);
console.log(totalWidth);
switch (totalWidth) {
case 0:
var width = 0.4;
var height = 0.15;
break;
case 1:
var width = 0.7;
var height = 0.15;
break;
case 2:
var width = 1;
var height = 0.15;
break;
case totalWidth > 2:
var width = 'auto';
var height = 'auto';
break;
}
var geometry = 'primitive: plane; height: ' + height + '; width: ' + width;
aTextPopUP.setAttribute('geometry', geometry);
aTextPopUP.setAttribute('text', value);
console.log(txtInfo);
aTextPopUP.setAttribute('visible', true);
}
Looks good!
Currently the popup in AFrame takes a lot space, It is possible to reduce this space