Scoop API

scoop:scoop.ui:0.1.0

src/interaction/drag_values.scoop

Selected production source · src/interaction/drag_values.scoop

1package scoop.ui
3import scoop.graphics.Point
4import scoop.surface.InputCancelReason
5import scoop.window.ContactId
6import scoop.window.ContactKind
7import scoop.window.InputTime
8import scoop.window.MouseButton
10public enum DragAxis {
11 Horizontal, Vertical
14public class DragOptions public constructor(
15 public val axis: DragAxis,
16 public val threshold: Double = 4.0,
17 public val enabled: Boolean = true,
18 public val button: MouseButton = MouseButton.Left,
19 public val contacts: Boolean = true,
20 public val mouse: Boolean = true
21) {
22 init {
23 requireUi(
24 threshold.isFinite() && threshold >= 0.0,
25 "drag threshold must be finite and nonnegative"
26 )
27 }
30public enum DragInput {
31 Mouse(MouseButton), Contact(ContactId, ContactKind)
34public struct DragSample(
35 val start: Point,
36 val position: Point,
37 val displacement: Double,
38 val velocity: Double,
39 val startTime: InputTime,
40 val time: InputTime,
41 val input: DragInput
44public enum DragCancelReason {
45 Input(
46 InputCancelReason
47 ), Disabled, ConfigurationChanged, GeometryUnavailable, AdditionalContact, Explicit, Closed,
48 PreventedMovement, PreventedRelease
51public enum DragEvent {
52 Started(DragSample), Moved(DragSample), Ended(DragSample), Cancelled(
53 DragSample,
54 DragCancelReason
55 )