Add media components 346-365; input.SlideBase, guarded Pad
An audio player with transport, scrubber and volume; an equalizer and a visualizer; a playlist; a cassette, cartridge and record that turn while they play and hold where they stop; piano keys, a step sequencer and a tracker you can type into; a waveform, a 16:9 video frame, an image compare, a gallery, a filmstrip, a record button and an FM tuner. input exports SlideBase, the undrawn rail its sliders share; the gallery treats exported Bases as building blocks, not components. pixel's micro font gains '#' for notes like C#4. pixel.Pad and the slide rail read input only while their base is enabled, so Inert or a fresh Disabled stops a drag or a key already sent. AGENTS records why a drawn container keeps the DISABLED description: MyGo paints a disabled subtree at half opacity.
This commit is contained in:
39 files changed
+3066
-10
No files matched your search
+16
-1
@@ -39,6 +39,20 @@ func Slider(c *ui.Context, text string, value *float64, o SliderOptions) SliderR
|
||||
return report(shell, changed, "slider", text, *value)
|
||||
}
|
||||
|
||||
// RailOptions shape a SlideBase.
|
||||
type RailOptions struct {
|
||||
// Zeros mean 0 to 1; a zero Step glides.
|
||||
Min, Max, Step float64
|
||||
Vertical bool
|
||||
Disabled bool
|
||||
}
|
||||
|
||||
// SlideBase is an undrawn slider: pointer and keys set *value.
|
||||
func SlideBase(c *ui.Context, text string, value *float64, o RailOptions) (shell *ui.Element, st pixel.State, changed bool) {
|
||||
lo, hi := bounds(o.Min, o.Max)
|
||||
return slide(c, value, rail{lo: lo, hi: hi, step: o.Step, vertical: o.Vertical, label: text, disabled: o.Disabled})
|
||||
}
|
||||
|
||||
// rail maps a slide's pointer and keys to a value.
|
||||
type rail struct {
|
||||
lo, hi, step float64
|
||||
@@ -54,7 +68,8 @@ func slide(c *ui.Context, v *float64, r rail) (*ui.Element, pixel.State, bool) {
|
||||
})
|
||||
old := *v
|
||||
set := r.snap(v)
|
||||
if !r.disabled {
|
||||
// The base, not the option: Inert disables it too.
|
||||
if !base.IsDisabled() {
|
||||
if _, _, held := base.Dragged(); held {
|
||||
px, py, _ := base.PointerPosition()
|
||||
b := base.Bounds()
|
||||
|
||||
Reference in new issue
Block a user