Fixed two issues with slider.

Value was always set back to original value.
Events were always handled by slider (handle).
This commit is contained in:
Sander Schobers 2021-01-09 17:07:10 +01:00
parent 102c187566
commit 9dc301eed8

View File

@ -110,7 +110,6 @@ func (s *Slider) DesiredSize(ctx Context, _ geom.PointF32) geom.PointF32 {
} }
func (s *Slider) Handle(ctx Context, e Event) bool { func (s *Slider) Handle(ctx Context, e Event) bool {
defer s.setValue(s.Value)
if s.handle.Handle(ctx, e) { if s.handle.Handle(ctx, e) {
return true return true
} }
@ -166,11 +165,11 @@ func (h *sliderHandle) Handle(ctx Context, e Event) bool {
h.ControlBase.Handle(ctx, e) h.ControlBase.Handle(ctx, e)
if h.IsOver() { if h.IsOver() {
if h.Disabled { if h.Disabled {
return true return false
} }
ctx.Renderer().SetMouseCursor(MouseCursorPointer) ctx.Renderer().SetMouseCursor(MouseCursorPointer)
} }
return true return false
} }
func (h *sliderHandle) Render(ctx Context) { func (h *sliderHandle) Render(ctx Context) {