Vixen
feb85697
csharp
public enum TouchAction

What a finger that lands on an element may do to the scrollable thing around it.

Read the guide page for this →

Remarks

CSS's touch-action, as a set. The property is a negotiation between an element and the user-agent behaviour a touch would otherwise get — here a ScrollView dragging its content under a finger. A slider inside a list says touch-action: none so that the finger on it moves the knob and not the list; a horizontal carousel says pan-y so that a vertical swipe still scrolls the page while a horizontal one belongs to the carousel.

⚠ Flags, because the grammar is a union. pan-x pan-down pinch-zoom is one declaration and three permissions. PanX is both horizontal directions and PanY both vertical, so a consumer asks "may this axis move" with one mask whether the author wrote the axis or one of its directions.

⚠ The directional keywords are a test on how the gesture BEGINS, not a boundary check. The parity ledger recorded pan-left/pan-right/pan-up as needing "an at-boundary check nothing computes". They do not: Pointer Events § 6 says the user agent may consider the touch "only for the purposes of scrolling that starts in the given direction", and Chrome implements that as a sign test on the scroll-begin hint. pan-left admits a gesture whose first movement scrolls the content leftward — the viewport moving toward the left edge, ScrollLeft decreasing, the finger travelling right — and once admitted the whole gesture is an ordinary horizontal pan.

⚠ Touch and pen only. The property governs touch and nothing else; a consumer reads PointerType first and consults this only for a finger or a stylus, because touch-action: none on a map must not stop the map responding to a mouse drag, which no browser does. That is the whole reason PointerType exists.

PinchZoom and DoubleTapZoom are carried so that the value round-trips — manipulation is auto minus the double-tap — but nothing in this engine performs either gesture as a user-agent default today, so those two bits govern nothing yet. They are here so that the consumer which grows one knows where to ask.

Fields and properties (11)

  • None

    none: the finger belongs to the element and nothing around it may pan.

  • PanLeft

    pan-left: a horizontal pan that begins by scrolling the content leftward.

  • PanRight

    pan-right: a horizontal pan that begins by scrolling the content rightward.

  • PanUp

    pan-up: a vertical pan that begins by scrolling the content upward.

  • PanDown

    pan-down: a vertical pan that begins by scrolling the content downward.

  • PinchZoom

    pinch-zoom: two fingers may scale whatever performs the user-agent zoom.

  • DoubleTapZoom

    The double-tap zoom auto permits and manipulation withholds.

  • PanX

    pan-x: horizontal panning, either way.

  • PanY

    pan-y: vertical panning, either way.

  • Manipulation

    manipulation: panning and pinching, without the double-tap zoom's delay.

  • Auto

    auto: everything, which is what an element that says nothing gets.

Used by (6)

  • RowVixen.Ui.Controls.Advanced.Tests
  • ScrollViewVixen.Ui.Controls
  • TouchActionCensusTestsVixen.Ui.Controls.Advanced.Tests
  • TouchActionReaderVixen.Ui
  • TouchActionTestsVixen.Ui.Controls.Tests
  • UiDocumentVixen.Ui