KMPMedia 1.15.0 — Gesture + physics interactivity
Clip media to any shape — now grab, drag, pinch-zoom, twist-rotate, fling and spring it back. The interactivity half of Bet 4 — Interactivity primitives on the roadmap, productized out of the demo.
One modifier does both halves:
- Applies the pan / zoom / rotation through a single
graphicsLayer(a GPU-layer transform — no recomposition, holds 60fps). - Drives it from a custom
awaitEachGestureloop: one-/two-finger drag pans, pinch zooms (clamped), twist rotates, and on release the pan carries on with an exponential-decay momentum fling then springs back inside its bounds.
Pass an OGHitArea and the touch is shape-aware — a drag only starts inside the clip's silhouette, so the transparent corners of a triangle / circle / lasso fall through instead of grabbing it (and touches there pass to whatever is behind).
New API — com.solidkey.painpoints.gesture
Modifier.ogInteractive(state, hitArea?)— plus a convenience overload that remembers its own state.OGInteractionState/rememberOGInteractionState(...)— liveoffset/scale/rotationAnimatables you can read (HUD, other effects) +reset().OGInteractionConfig(presetsDragOnly/PanZoom/All) +OGPanBounds— size-independent pan limits (a fraction of content size, so one config works at any resolution).OGHitArea— a normalized0..1hit region:RECT/CIRCLE/TRIANGLE_UP/TRIANGLE_DOWN/DIAMOND/polygon(...)/of(OGShapeType).
Zero new dependency; identical on Android & iOS. Purely additive — a new package, nothing existing changed. The hit-test + clamp maths are pure and unit-tested on JVM + iOS (16 tests); live-verified on Android (drag in all directions, pan bounds + spring settle, shape-aware grab/ignore).
implementation("se.solidkey:kmpmedia-lib:1.15.0")See docs/INTERACTIVE.md and the full CHANGELOG.md. The demo's Interactive shapes screen dogfoods it.