forked from mbk-lab/rui_orig
2
0
Fork 0

Bug fixing

This commit is contained in:
Alexei Anoshenko 2022-05-03 12:12:57 +03:00
parent 61ee6c03f2
commit 12fd5521e5
5 changed files with 32 additions and 18 deletions

View File

@ -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] == '#' {

View File

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

View File

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

View File

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

View File

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