mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
{gesture,widget}: expose Dragging
Knowing whether a widget is being interacted with allows to implement bi-directional updates without feedbacks. Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
@@ -368,6 +368,9 @@ func (d *Drag) Events(cfg unit.Metric, q event.Queue, axis Axis) []pointer.Event
|
||||
return events
|
||||
}
|
||||
|
||||
// Dragging reports whether it's currently in use.
|
||||
func (d *Drag) Dragging() bool { return d.dragging }
|
||||
|
||||
func (a Axis) String() string {
|
||||
switch a {
|
||||
case Horizontal:
|
||||
|
||||
@@ -21,6 +21,9 @@ type Float struct {
|
||||
changed bool
|
||||
}
|
||||
|
||||
// Dragging returns whether the value is being interacted with.
|
||||
func (f *Float) Dragging() bool { return f.drag.Dragging() }
|
||||
|
||||
// Layout processes events.
|
||||
func (f *Float) Layout(gtx layout.Context, pointerMargin int, min, max float32) layout.Dimensions {
|
||||
size := gtx.Constraints.Min
|
||||
|
||||
Reference in New Issue
Block a user