From a84be115fdddeae9123bf85a8cae45b00c682574 Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko Date: Tue, 16 Aug 2022 11:40:42 +0300 Subject: [PATCH] Bug fixing --- bounds.go | 14 ++++++++++++-- checkbox.go | 4 ++-- radius.go | 9 +++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/bounds.go b/bounds.go index ed4ddb2..3a742bb 100644 --- a/bounds.go +++ b/bounds.go @@ -260,6 +260,12 @@ func (properties *propertyList) setBounds(tag string, value any) bool { case SizeUnit: properties.properties[tag] = value + case float32: + properties.properties[tag] = Px(float64(value)) + + case float64: + properties.properties[tag] = Px(value) + case Bounds: bounds := NewBoundsProperty(nil) if value.Top.Type != Auto { @@ -292,8 +298,12 @@ func (properties *propertyList) setBounds(tag string, value any) bool { properties.properties[tag] = bounds default: - notCompatibleType(tag, value) - return false + if n, ok := isInt(value); ok { + properties.properties[tag] = Px(float64(n)) + } else { + notCompatibleType(tag, value) + return false + } } } diff --git a/checkbox.go b/checkbox.go index e0eb2f2..1a782c8 100644 --- a/checkbox.go +++ b/checkbox.go @@ -406,11 +406,11 @@ func IsCheckboxChecked(view View, subviewID string) bool { // GetCheckboxVerticalAlign return the vertical align of a Checkbox subview: TopAlign (0), BottomAlign (1), CenterAlign (2) // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned func GetCheckboxVerticalAlign(view View, subviewID string) int { - return enumStyledProperty(view, subviewID, VerticalAlign, LeftAlign, false) + return enumStyledProperty(view, subviewID, CheckboxVerticalAlign, LeftAlign, false) } // GetCheckboxHorizontalAlign return the vertical align of a Checkbox subview: LeftAlign (0), RightAlign (1), CenterAlign (2) // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned func GetCheckboxHorizontalAlign(view View, subviewID string) int { - return enumStyledProperty(view, subviewID, VerticalAlign, TopAlign, false) + return enumStyledProperty(view, subviewID, CheckboxHorizontalAlign, TopAlign, false) } diff --git a/radius.go b/radius.go index 11462e0..44cf6e9 100644 --- a/radius.go +++ b/radius.go @@ -645,7 +645,16 @@ func (properties *propertyList) setRadius(value any) bool { properties.properties[Radius] = radius return true + case float32: + return properties.setRadius(Px(float64(value))) + + case float64: + return properties.setRadius(Px(value)) + default: + if n, ok := isInt(value); ok { + return properties.setRadius(Px(float64(n))) + } notCompatibleType(Radius, value) }