openpencil/packages/docs/programmable/sdk/api/composables/use-mask.md
Danila Poyarkov 0aae91f4f2 feat(editor): add blend mode and mask controls
- Add selection mask commands, shortcuts, context-menu access, and mask type controls
- Add mixed-selection blend mode editing with single-step undo
- Document the headless mask composable and localize the new controls
2026-07-10 17:01:28 +03:00

790 B

title description
useMask Read and update mask state for the selected node.

useMask

useMask() provides headless state and actions for mask controls in a property panel.

Usage

import { useMask } from '@open-pencil/vue'

const { active, maskType, setMaskType } = useMask()
  • active is true when exactly one selected node is being used as a mask.
  • maskType is the selected node's ALPHA, VECTOR, or LUMINANCE mask type.
  • setMaskType(type) updates the active mask with undo support.

Use the selection.toggleMask editor command to turn masking on or off so toolbar, context-menu, and keyboard behavior stays consistent.