Bug fixing

This commit is contained in:
Alexei Anoshenko 2022-08-16 11:40:42 +03:00
parent 9a5fd64758
commit a84be115fd
3 changed files with 23 additions and 4 deletions

View File

@ -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
}
}
}

View File

@ -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)
}

View File

@ -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)
}