Skip to content

feat: add ribbon layer selector with layer actions and state restore#233

Merged
mlightcad merged 1 commit intomainfrom
feat/ribbon-layer
Apr 22, 2026
Merged

feat: add ribbon layer selector with layer actions and state restore#233
mlightcad merged 1 commit intomainfrom
feat/ribbon-layer

Conversation

@mlightcad
Copy link
Copy Markdown
Owner

Summary

  • Add a new MlLayerSelect component with searchable layer options, inline state toggles (on/frozen/locked), line preview, and localized tooltips.
  • Expand ribbon Home tab layer tooling to support layer selection plus action buttons (off/isolate/freeze/lock/current/all-on/unisolate/thaw/unlock/restore).
  • Refactor useLayers into a fuller layer state manager with document/sysvar sync, mutation helpers, and snapshot capture/restore.
  • Align related UI surfaces (MlLayerDrawStyleToolbar, MlLayerList) to reuse useLayers operations instead of ad-hoc DB writes.
  • Update layer icon assets and bump @mlightcad/ribbon from 0.0.8 to 0.0.9.

Why

  • Provide AutoCAD-style layer workflows directly in the ribbon for faster drawing-state control.
  • Centralize layer state mutation and synchronization logic to reduce duplicated behavior and improve consistency across components.
  • Improve usability with richer tooltips, searchable layer selection, and one-click state actions.

What Changed

  • packages/cad-viewer/src/component/common/MlLayerSelect.vue added as a reusable, interactive layer selector.
  • packages/cad-viewer/src/composable/useLayers.ts now exposes:
    • layer state toggles (on, frozen, locked)
    • isolate/all-on actions
    • current-layer setter
    • snapshot capture/apply for restore behavior
    • document/sysvar event binding and cleanup
  • packages/cad-viewer/src/component/layout/MlRibbonCommands.vue integrates useLayers and adds new ribbon layer action handling, including isolate snapshot + restore flow.
  • packages/cad-viewer/src/component/layout/MlLayerDrawStyleToolbar.vue switches to MlLayerSelect and layer-state toggle events.
  • packages/cad-viewer/src/component/palette/MlLayerList.vue now calls shared composable methods (setLayerOn, setLayerColor).
  • packages/cad-viewer/src/locale/en/main.ts and packages/cad-viewer/src/locale/zh/main.ts add new ribbon/layer tooltip and selector strings.
  • packages/cad-viewer/src/svg/layer/* adds isolate/light/locker/snow/unisolate icons and updates existing layer icons.
  • packages/cad-viewer/package.json and pnpm-lock.yaml upgrade @mlightcad/ribbon to 0.0.9.

Risks / Notes

  • LayerInfo shape changed (isHidden -> isFrozen), which may impact any downstream code that referenced the old property.
  • MlLineWeightSelect moved from i18n labels to fixed English labels and excludes ByDIPs; confirm this is intended UX behavior.
  • Layer restore/isolation state is in-memory per active session/document activation flow; validate expected behavior across document switches.

@mlightcad mlightcad self-assigned this Apr 22, 2026
@mlightcad mlightcad added the enhancement New feature or request label Apr 22, 2026
@mlightcad mlightcad merged commit a9ecda4 into main Apr 22, 2026
2 checks passed
@mlightcad mlightcad deleted the feat/ribbon-layer branch April 22, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant