Vue composables for stroke stabilization
npm install @stroke-stabilizer/vue


> This is part of the stroke-stabilizer monorepo
Vue composables for stroke stabilization in digital drawing applications.
``bash`
npm install @stroke-stabilizer/vue @stroke-stabilizer/core
`vue
`
> Important: Always use getCoalescedEvents() to capture all pointer events between frames. Without it, browsers throttle events and you'll get choppy strokes.
For high-frequency input devices, use the underlying StabilizedPointer's batch processing:
`vue
`
A composable for managing stabilization level with reactive state.
`vue
type="range"
:min="0"
:max="100"
:value="level"
@input="setLevel(Number(($event.target as HTMLInputElement).value))"
/>
{{ level }}%
Stabilization enabled
`
Creates a stabilized pointer instance.
Options:
- level - Stabilization level (0-100). Uses preset when specifiedfilters
- - Custom filter array. Used when level is not specifiedonPoint
- - Callback when a point is processed
Returns:
- process(point) - Process a single pointprocessAll(points)
- - Process multiple pointsflushBuffer()
- - Flush internal bufferfinish()
- - Apply post-processing and return final points (auto-appends endpoint)reset()
- - Reset the pointer stateaddFilter(filter)
- - Add a filter dynamicallyremoveFilter(type)
- - Remove a filter by typeupdateFilter(type, params)
- - Update filter parameterspointer
- - Computed ref to the StabilizedPointer instancefilterCount
- - Computed ref to the number of active filters
Manages stabilization level state.
Options:
- initialLevel - Initial level (default: 0)min
- - Minimum level (default: 0)max
- - Maximum level (default: 100)onChange
- - Callback when level changes
Returns:
- level - Computed ref to current levelsetLevel(value)
- - Set the levelincrease(amount?)
- - Increase level by amount (default: 10)decrease(amount?)
- - Decrease level by amount (default: 10)isEnabled` - Computed ref indicating if stabilization is active (level > 0)
-