forked from mbk-lab/rui_orig
Bug fixing
This commit is contained in:
parent
61ee6c03f2
commit
12fd5521e5
2
color.go
2
color.go
|
@ -84,7 +84,7 @@ func stringToColor(text string) (Color, error) {
|
||||||
|
|
||||||
text = strings.Trim(text, " \t\r\n")
|
text = strings.Trim(text, " \t\r\n")
|
||||||
if text == "" {
|
if text == "" {
|
||||||
return 0, errors.New(`Invalid color value: ""`)
|
return 0, errors.New(`invalid color value: ""`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if text[0] == '#' {
|
if text[0] == '#' {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package rui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
@ -231,13 +232,17 @@ func (picker *numberPickerData) htmlProperties(self View, buffer *strings.Builde
|
||||||
}
|
}
|
||||||
|
|
||||||
min, max := GetNumberPickerMinMax(picker, "")
|
min, max := GetNumberPickerMinMax(picker, "")
|
||||||
|
if min != math.Inf(-1) {
|
||||||
buffer.WriteString(` min="`)
|
buffer.WriteString(` min="`)
|
||||||
buffer.WriteString(strconv.FormatFloat(min, 'f', -1, 64))
|
buffer.WriteString(strconv.FormatFloat(min, 'f', -1, 64))
|
||||||
buffer.WriteByte('"')
|
buffer.WriteByte('"')
|
||||||
|
}
|
||||||
|
|
||||||
|
if max != math.Inf(1) {
|
||||||
buffer.WriteString(` max="`)
|
buffer.WriteString(` max="`)
|
||||||
buffer.WriteString(strconv.FormatFloat(max, 'f', -1, 64))
|
buffer.WriteString(strconv.FormatFloat(max, 'f', -1, 64))
|
||||||
buffer.WriteByte('"')
|
buffer.WriteByte('"')
|
||||||
|
}
|
||||||
|
|
||||||
step := GetNumberPickerStep(picker, "")
|
step := GetNumberPickerStep(picker, "")
|
||||||
if step != 0 {
|
if step != 0 {
|
||||||
|
@ -305,14 +310,24 @@ func GetNumberPickerMinMax(view View, subviewID string) (float64, float64) {
|
||||||
view = ViewByID(view, subviewID)
|
view = ViewByID(view, subviewID)
|
||||||
}
|
}
|
||||||
if view != nil {
|
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 {
|
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 {
|
if !ok {
|
||||||
min, _ = floatStyledProperty(view, Max, 1)
|
max, _ = floatStyledProperty(view, Max, defMax)
|
||||||
}
|
}
|
||||||
|
|
||||||
if min > max {
|
if min > max {
|
||||||
|
|
|
@ -396,8 +396,6 @@ const (
|
||||||
Value = "value"
|
Value = "value"
|
||||||
// Orientation is the constant for the "orientation" property tag.
|
// Orientation is the constant for the "orientation" property tag.
|
||||||
Orientation = "orientation"
|
Orientation = "orientation"
|
||||||
// Anchor is the constant for the "anchor" property tag.
|
|
||||||
Anchor = "anchor"
|
|
||||||
// Gap is the constant for the "gap" property tag.
|
// Gap is the constant for the "gap" property tag.
|
||||||
Gap = "gap"
|
Gap = "gap"
|
||||||
// Text is the constant for the "text" property tag.
|
// Text is the constant for the "text" property tag.
|
||||||
|
|
|
@ -346,11 +346,6 @@ var enumProperties = map[string]struct {
|
||||||
"vertical-align",
|
"vertical-align",
|
||||||
[]string{"top", "bottom", "middle", "baseline", "baseline"},
|
[]string{"top", "bottom", "middle", "baseline", "baseline"},
|
||||||
},
|
},
|
||||||
Anchor: {
|
|
||||||
[]string{"top", "bottom"},
|
|
||||||
"",
|
|
||||||
[]string{"top", "bottom"},
|
|
||||||
},
|
|
||||||
Cursor: {
|
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"},
|
[]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,
|
Cursor,
|
||||||
|
|
6
view.go
6
view.go
|
@ -567,6 +567,12 @@ func viewPropertyChanged(view *viewData, tag string) {
|
||||||
updateCSSProperty(htmlID, ZIndex, strconv.Itoa(i), session)
|
updateCSSProperty(htmlID, ZIndex, strconv.Itoa(i), session)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
||||||
|
case Row, Column:
|
||||||
|
if parent := view.parentHTMLID(); parent != "" {
|
||||||
|
updateInnerHTML(parent, session)
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if cssTag, ok := sizeProperties[tag]; ok {
|
if cssTag, ok := sizeProperties[tag]; ok {
|
||||||
|
|
Loading…
Reference in New Issue