ObjectProfile / Roassal3Exporters

PDF Exporter for Roassal3
MIT License
8 stars 3 forks source link

Reduce Popup padding in text #16

Closed akevalion closed 3 years ago

akevalion commented 3 years ago

Currently the popup in AFrame takes a lot space, It is possible to reduce this space

image

ThisIsAntonio commented 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.

image

image

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);
          }
akevalion commented 3 years ago

Looks good!