I'm using some functions to help determine label/icon sizes. I pass through the height/width of the widget using a global function that for example returns my label size based on those.
font-size: #{globals.setLabelSize(@{this.height}, @{this.width})};
globals.setLabelSize = (h, w = h) => {
if (globals.screen.width <= 1400) {
return ((parseFloat(h) + parseFloat(w))/2) * 1.25 + "rem"
}
return ((parseFloat(h) + parseFloat(w))/2) * 2 + "rem"
}
This works. However, if a widget is in a grid, the result of @{this.height
or @{this.width}
is calculated from the parent container (grid). So, if I have 4 buttons in a grid, one button's height would roughly be around ~25%. In reality, the computed height is roughly 100ish px in my example below accordingly to the dev tools. Here is the picture below, the two purple buttons are showing the @{this.height}
. The left is the grid, and the right is the same size outside the div and the difference is drastic which makes sense.
I'm just wondering if it's possible to actually grab the computed height somehow instead so I can work with my global function still?
Cheers,
DMDComposer