Skip to content

feat: add CAD monochrome plot mode - #244

Merged
wybaby168 merged 19 commits into
mainfrom
feature/issue-213-monochrome-cad
Sep 5, 2026
Merged

wybaby168 merged 19 commits into
mainfrom
feature/issue-213-monochrome-cad

Conversation

@brownie-cake

@brownie-cake brownie-cake commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Integrate the released CAD engine color policy into File Viewer without a CSS filter.

  • Adds source/monochrome options, toolbar state, i18n labels, and view-state reporting.
  • Keeps the parser-owned CAD source for layer updates and defaults monochrome output to black.
  • Preserves Vue 2.6 and Vue 2.7 sample paths.

Related Issue

Closes #213. The same engine-level behavior also covers the monochrome print requirement in #245.

Change Classification

  • User-visible UI or rendering change
  • Non-visual change
  • File-format or renderer behavior
  • Public API, package, Worker, WASM, or deployment-path change

Verification

  • pnpm --filter @file-viewer/renderer-cad verify:color-mode — Pass.
  • pnpm --filter @file-viewer/renderer-cad type-check — Pass.
  • pnpm vitest run test/core-operations.spec.ts test/core-registry.spec.ts — Pass (43 tests).
  • pnpm audit --registry=https://registry.npmjs.org --audit-level=low — Pass; the documented Vue 2 low advisory remains ignored.
  • Real Chromium regression: 4,842 authored-color pixels, 0 colored pixels in monochrome mode, restored source colors, layer toggle, HTML export, and Print — Pass.

Sample / Fixture Evidence

  • apps/viewer-demo/public/example/sample.dwg

Visual Evidence

Source colors
Monochrome black
Source colors restored

Risk And Compatibility

  • Affected packages/formats: @file-viewer/core and the CAD renderer for DWG, DXF, DWF, and DWFX.
  • Compatibility or migration risk: older CAD engines without setColorMode() keep the toggle disabled; Vue 2.6 and Vue 2.7 samples remain unchanged.
  • Rollback: revert the File Viewer CAD integration and dependency update; source documents remain unmodified.

Checklist

  • I added or updated focused automated coverage, or explained why it is not needed.
  • I updated user-facing documentation or release notes when behavior or API changed, or marked them not applicable.
  • I verified offline/private-deployment paths when changing Worker, WASM, fonts, vendor assets, or URLs.
  • I did not commit secrets, customer files, private samples, generated caches, or unrelated changes.

@wybaby168

Copy link
Copy Markdown
Member

Not merging as-is, and I would rather put the reason on record than close it quietly. packages/renderers/cad pins @flyfish-dev/cad-viewer@0.8.0, and that published engine has no setColorMode, so cad.monochrome would have nothing to call at runtime. The blocker is the engine version, not your design.
Once a cad-viewer release exposes a colour-mode API, a rebased PR against it, dropping the public-ci.yml edit and adding a rendered before and after of the same DWG, is welcome. Leaving this open.

@wybaby168
wybaby168 merged commit ddc8a2b into main Sep 5, 2026
8 checks passed
@wybaby168 wybaby168 mentioned this pull request Sep 7, 2026
2 tasks
@wybaby168
wybaby168 deleted the feature/issue-213-monochrome-cad branch September 19, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: 希望增加黑白线条界面

2 participants