Color editing popups use swatch label for title
This commit is contained in:
parent
e8a3a376ea
commit
48bfa05452
@ -62,8 +62,6 @@ func RGBAToHSVA (r, g, b, a uint32) HSVA {
|
||||
// Adapted from:
|
||||
// https://www.cs.rit.edu/~ncs/color/t_convert.html
|
||||
|
||||
// FIXME: this does not always work!
|
||||
|
||||
component := func (x uint32) float64 {
|
||||
return clamp01(float64(x) / 0xFFFF)
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ func NewLabelSwatch (value color.Color, text string) *LabelSwatch {
|
||||
label: NewLabel(text),
|
||||
}
|
||||
box.SetRole(tomo.R("objects", "LabelSwatch", ""))
|
||||
box.swatch.label = text
|
||||
box.label.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
|
||||
box.Add(box.swatch)
|
||||
box.Add(box.label)
|
||||
|
@ -14,6 +14,7 @@ type Swatch struct {
|
||||
tomo.CanvasBox
|
||||
value color.Color
|
||||
editing bool
|
||||
label string
|
||||
on struct {
|
||||
valueChange event.FuncBroadcaster
|
||||
}
|
||||
@ -72,7 +73,11 @@ func (this *Swatch) Choose () {
|
||||
log.Println("objects: could not create swatch modal:", err)
|
||||
return
|
||||
}
|
||||
if this.label == "" {
|
||||
window.SetTitle("Select Color")
|
||||
} else {
|
||||
window.SetTitle(this.label)
|
||||
}
|
||||
|
||||
colorPicker := NewColorPicker(this.Value())
|
||||
colorPicker.OnValueChange(func () {
|
||||
|
Loading…
Reference in New Issue
Block a user