Skip to main content

How a stroke is matched

When you let go of a draw button, Input.Observer decides in two stages what to run:

  1. Which shape did you draw? The stroke is scored against the gestures in scope, and the best score wins if it reaches the match threshold. This page explains this stage.
  2. Which action uses that shape here? The app group's triggers for that shape are checked for modifiers, draw button, region and profile. See Scope and fallback rules.

The live hint uses exactly the same two stages on the stroke drawn so far, so the hint always names what would run if you let go at that moment.

How a stroke is scored​

Each comparison gives a score from 0 to 100:

  1. The stroke is smoothed slightly, to remove hand tremor.
  2. It is resampled into a fixed number of evenly spaced points along its length (36 by default).
  3. The direction of each short segment between two points is compared with the direction of the same segment in a saved example.
  4. The average difference becomes the score: 100 when every segment points the same way, 0 when every segment points the opposite way.

What that means when you draw:

What changesEffect on the score
Size, or where on the screen you drawNone
Drawing speedNone
Direction: right-to-left instead of left-to-rightThe opposite direction scores near 0
Rotation: a shape drawn tiltedLower, more so the more it is tilted
Starting point: a circle started at the top or at the bottom, clockwise or counterclockwiseEach is a different shape
Proportions: an L with a long or a short footLower: each part takes a different share of the stroke

A gesture with several examples is scored against each of them. Example scoring decides how those scores combine: Best example (the default) takes the highest; Average of all examples takes their average, so a stroke close to one example but far from the others scores lower.

Which shapes compete​

A stroke is not compared with the whole library, only with the shapes in scope for the window you pressed over:

  • every shape a gesture trigger uses in the app group that owns the window, and
  • every shape a gesture trigger uses in the Global group, when that group can fall back to Global (see Scope and fallback rules).

A shape counts as soon as any trigger in those groups uses it, even when that trigger can't run right now: its action is turned off, it is limited to another profile, it needs a modifier you didn't press, or it needs another draw button or region. Such a shape can still win the stroke, and then nothing runs. A shape no trigger in scope uses never competes, so it can never win there.

The winner​

  • The highest score wins, provided it is at or above the match threshold. With nothing at or above the threshold, nothing matches.
  • Exactly equal scores: the shape met first wins: the app group's own shapes before Global's, in the order of the group's action list.
  • There is no second choice. Once a shape wins, only actions for that shape are looked for: in the app group first, then in Global if the group falls back. If none fits (for example, it needs Shift and you didn't press it), nothing runs, even if a lower-scoring shape had an action that would have fit.

The nearest shape in scope wins​

Because only shapes in scope compete, a stroke that plainly is some other shape still matches the closest shape in scope, if that one reaches the threshold.

Example: the Global group uses three shapes: Swipe down, Swipe left and Checkmark. Over a window no app group owns, you draw Swipe up. Swipe up is in the library, but no trigger in scope uses it, so it doesn't compete. The stroke is scored against the three shapes in scope; if Checkmark scores highest and reaches the threshold, the Checkmark action runs.

Two ways to stop this:

  • Bind the shape in scope to an action that does nothing. It then competes, scores highest for its own stroke, and runs nothing. When the App groups page finds such a case it shows the banner "A stroke here can run the wrong action", and its Add do-nothing action button adds that action for you. See App groups.
  • Raise the match threshold, so a stroke has to be closer to a shape to count.

The gesture's own Runs other actions card on the Gestures page lists the same cases from the shape's side.

When nothing matches​

A stroke that matches no action, at any scope:

  • runs nothing;
  • does not give the click back: the window under the pointer receives nothing;
  • runs the Nothing matched global event, if you set one up (for example, to play a sound). See Global events.

The hint disappears while the stroke so far matches nothing, so a missing hint tells you in advance.

Settings​

Matching settings are on the Gestures page, Settings tab, in the Gesture matching card.

Input.ObserverSimpleAdvanced
AUTOMATION
Actions
Text expansion
Snippets
Sandbox
App groups
Ignore groups
Gestures
SETUP
General
Appearance
Security
Help
About
Gestures
ShapesSettings
Gesture matching
Match threshold
How closely a drawn stroke must match a saved gesture to count as a hit.
ForgivingStrict75
Stroke smoothing quality
Trades matching speed against accuracy. Editing the Advanced settings below switches this to Custom.
FastBalancedPrecise

Match threshold​

Match threshold ① is the lowest score that counts as a match: 75 by default, from 50 (Forgiving) to 100 (Strict).

  • Raise it when the wrong action runs, or a stroke you didn't mean as a gesture runs something. Sloppy strokes then match nothing more often.
  • Lower it when a stroke you meant as a gesture often matches nothing. Strokes that resemble none of your shapes then get taken by the nearest shape in scope more often.

The Gestures page's Draw to test card shows a stroke's score against this threshold. See The gesture library.

Stroke smoothing quality​

Stroke smoothing quality ② trades matching speed for accuracy. Each choice sets the number of resampled points and Example scoring together:

ChoicePointsExample scoring
Fast24Best example
Balanced (default)36Best example
Precise64Average of all examples

More points notice smaller details of a shape. Any other combination, set in Advanced mode, shows as Custom.

note

Advanced mode. The card adds three rows:

  • Resample precision: the number of points a stroke is resampled to, 8 to 128 (36 by default).
  • Example scoring: Best example or Average of all examples.
  • Training suggest threshold: the score, 0 to 100 (80 by default), at or above which the training window suggests saving a stroke as another example of the closest gesture rather than as a new gesture. It doesn't affect matching.