diff --git a/color.go b/color.go index 5ce76cc..ba29f12 100644 --- a/color.go +++ b/color.go @@ -84,7 +84,7 @@ func stringToColor(text string) (Color, error) { text = strings.Trim(text, " \t\r\n") if text == "" { - return 0, errors.New(`Invalid color value: ""`) + return 0, errors.New(`invalid color value: ""`) } if text[0] == '#' { diff --git a/numberPicker.go b/numberPicker.go index c126d99..0b44789 100644 --- a/numberPicker.go +++ b/numberPicker.go @@ -2,6 +2,7 @@ package rui import ( "fmt" + "math" "strconv" "strings" ) @@ -231,13 +232,17 @@ func (picker *numberPickerData) htmlProperties(self View, buffer *strings.Builde } min, max := GetNumberPickerMinMax(picker, "") - buffer.WriteString(` min="`) - buffer.WriteString(strconv.FormatFloat(min, 'f', -1, 64)) - buffer.WriteByte('"') + if min != math.Inf(-1) { + buffer.WriteString(` min="`) + buffer.WriteString(strconv.FormatFloat(min, 'f', -1, 64)) + buffer.WriteByte('"') + } - buffer.WriteString(` max="`) - buffer.WriteString(strconv.FormatFloat(max, 'f', -1, 64)) - buffer.WriteByte('"') + if max != math.Inf(1) { + buffer.WriteString(` max="`) + buffer.WriteString(strconv.FormatFloat(max, 'f', -1, 64)) + buffer.WriteByte('"') + } step := GetNumberPickerStep(picker, "") if step != 0 { @@ -305,14 +310,24 @@ func GetNumberPickerMinMax(view View, subviewID string) (float64, float64) { view = ViewByID(view, subviewID) } if view != nil { - min, ok := floatStyledProperty(view, NumberPickerMin, 0) + t, _ := enumStyledProperty(view, NumberPickerType, NumberEditor) + var defMin, defMax float64 + + if t == NumberSlider { + defMin = 0 + defMax = 1 + } else { + defMin = math.Inf(-1) + defMax = math.Inf(1) + } + min, ok := floatStyledProperty(view, NumberPickerMin, defMin) if !ok { - min, _ = floatStyledProperty(view, Min, 0) + min, _ = floatStyledProperty(view, Min, defMin) } - max, ok := floatStyledProperty(view, NumberPickerMax, 1) + max, ok := floatStyledProperty(view, NumberPickerMax, defMax) if !ok { - min, _ = floatStyledProperty(view, Max, 1) + max, _ = floatStyledProperty(view, Max, defMax) } if min > max { diff --git a/propertyNames.go b/propertyNames.go index a8797d4..b7f2773 100644 --- a/propertyNames.go +++ b/propertyNames.go @@ -396,8 +396,6 @@ const ( Value = "value" // Orientation is the constant for the "orientation" property tag. Orientation = "orientation" - // Anchor is the constant for the "anchor" property tag. - Anchor = "anchor" // Gap is the constant for the "gap" property tag. Gap = "gap" // Text is the constant for the "text" property tag. diff --git a/propertySet.go b/propertySet.go index dd4d0cf..ae55c28 100644 --- a/propertySet.go +++ b/propertySet.go @@ -346,11 +346,6 @@ var enumProperties = map[string]struct { "vertical-align", []string{"top", "bottom", "middle", "baseline", "baseline"}, }, - Anchor: { - []string{"top", "bottom"}, - "", - []string{"top", "bottom"}, - }, Cursor: { []string{"auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "e-resize", "n-resize", "ne-resize", "nw-resize", "s-resize", "se-resize", "sw-resize", "w-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "col-resize", "row-resize", "all-scroll", "zoom-in", "zoom-out", "grab", "grabbing"}, Cursor, diff --git a/view.go b/view.go index a7d1414..3ab207f 100644 --- a/view.go +++ b/view.go @@ -567,6 +567,12 @@ func viewPropertyChanged(view *viewData, tag string) { updateCSSProperty(htmlID, ZIndex, strconv.Itoa(i), session) } return + + case Row, Column: + if parent := view.parentHTMLID(); parent != "" { + updateInnerHTML(parent, session) + } + return } if cssTag, ok := sizeProperties[tag]; ok {