Improve label and default element measuring
This commit is contained in:
parent
d0734ae795
commit
30ca7ed0c5
|
@ -16,7 +16,7 @@ namespace Ooui.Forms.Extensions
|
||||||
if (self.Style.Width.Equals ("inherit")) {
|
if (self.Style.Width.Equals ("inherit")) {
|
||||||
s = self.Text.MeasureSize (self.Style);
|
s = self.Text.MeasureSize (self.Style);
|
||||||
measured = true;
|
measured = true;
|
||||||
rw = double.IsPositiveInfinity (s.Width) ? double.PositiveInfinity : s.Width;
|
rw = double.IsPositiveInfinity (s.Width) ? double.PositiveInfinity : Math.Ceiling (s.Width);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rw = self.Style.GetNumberWithUnits ("width", "px", 640);
|
rw = self.Style.GetNumberWithUnits ("width", "px", 640);
|
||||||
|
@ -27,7 +27,7 @@ namespace Ooui.Forms.Extensions
|
||||||
s = self.Text.MeasureSize (self.Style);
|
s = self.Text.MeasureSize (self.Style);
|
||||||
measured = true;
|
measured = true;
|
||||||
}
|
}
|
||||||
rh = double.IsPositiveInfinity (s.Height) ? double.PositiveInfinity : s.Height;
|
rh = double.IsPositiveInfinity (s.Height) ? double.PositiveInfinity : Math.Ceiling (s.Height * 1.4);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rh = self.Style.GetNumberWithUnits ("height", "px", 480);
|
rh = self.Style.GetNumberWithUnits ("height", "px", 480);
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace Ooui.Forms.Renderers
|
||||||
{
|
{
|
||||||
if (!_perfectSizeValid) {
|
if (!_perfectSizeValid) {
|
||||||
var size = Element.Text.MeasureSize (Element.FontFamily, Element.FontSize, Element.FontAttributes);
|
var size = Element.Text.MeasureSize (Element.FontFamily, Element.FontSize, Element.FontAttributes);
|
||||||
|
size.Width = Math.Ceiling (size.Width);
|
||||||
|
size.Height = Math.Ceiling (size.Height * 1.4);
|
||||||
_perfectSize = new SizeRequest (size, size);
|
_perfectSize = new SizeRequest (size, size);
|
||||||
_perfectSizeValid = true;
|
_perfectSizeValid = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue