Add layer on/off toggle to the .spd viewer - #141
Merged
Conversation
Bumps the supernote-typescript submodule to v0.5.3, which adds a visibleSurfaces filter to SupernoteAtelier.toCompositeImage() (supernote-typescript#37, fixing #35). SupernoteAtelierView now opens the .spd file once (openAtelierFile) and keeps the parsed SupernoteAtelier around instead of always calling the open-and-flatten-everything helper, so a checkbox toggle re-composites just the selected layers without re-parsing the sqlite database on every click. Layer labels come from SupernoteAtelier.layers when the `ls` config decoded; falls back to raw surface table names otherwise. The toggle panel is skipped for single-layer files, same "nothing to show here" logic SupernoteEmbed already uses for single-page .note files. SupernoteAtelierEmbed and the export commands keep using the simpler renderAtelierCompositeDataUrl() (open + flatten everything, no toggle state to manage) — refactored to share openAtelierFile/compositeDataUrl with the view instead of duplicating the wasm-loading boilerplate. One more item off #138 (viewport/zoom and device attach/upload still open).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Next slice of #138, on top of philips/supernote-typescript#37 (merged, released as v0.5.3): a per-layer show/hide toggle in
SupernoteAtelierView.supernote-typescriptsubmodule tov0.5.3, which adds an optionalvisibleSurfacesfilter toSupernoteAtelier.toCompositeImage().SupernoteAtelierViewnow opens the.spdfile once (openAtelierFile) and keeps the parsedSupernoteAtelieraround, instead of the open-and-flatten-everything helper it used before. A checkbox per layer toggles that layer's surface in/out of aSet, and each toggle re-composites (compositeDataUrl) just the currently-checked surfaces — no re-parsing the sqlite database per click.SupernoteAtelier.layers(decoded from thelsconfig) when available; falls back to rawsurface_Ntable names otherwise, same graceful-degradation the parser itself already does.SupernoteEmbedalready skips its page-nav toolbar for a single-page.note.SupernoteAtelierEmbedand the.spdexport commands (Add .spd export commands (PNG, PDF) #140) are unaffected — they don't need toggle state, so they keep usingrenderAtelierCompositeDataUrl()(now refactored to shareopenAtelierFile/compositeDataUrlinternally with the view instead of duplicating the wasm-loading boilerplate).Still open on #138 after this: viewport/zoom, device attach/upload.
Test plan
npm run buildsucceedsnpm test— all 95 existing tests still passnpm run lint— no new warnings/errorstoCompositeImage(visibleSurfaces)againstsupernote-typescript/tests/input/real-device.spdoutside the plugin (same path the toggle uses): hiding the "Reference Layer" surface leaves only the two sketch layers on a transparent background, and an empty visible set returnsnull— visually inspected the output.spdPRs)