Skip to content

feat(panel): show when Before/After is hiding layers and remember panel layers across file reopen - #6

Merged
hongducdev merged 3 commits into
mainfrom
hongducdev/fix/before-after-limits
Nov 8, 2026
Merged

hongducdev merged 3 commits into
mainfrom
hongducdev/fix/before-after-limits

Conversation

@hongducdev

Copy link
Copy Markdown
Owner

Summary

  • The Trước / Sau button turns red and reads Ảnh gốc while the panel layers are hidden, so a user does not save an un-retouched image by mistake. The state is read from Photoshop after every panel command and when the panel regains focus; the panel keeps no state of its own.
  • The ids of panel layers are written into the document XMP, so closing and reopening a PSD keeps the comparison working. Hidden or shown is derived from layer visibility, not stored state, so it also survives a reopened file and layers changed outside the panel.
  • Simplified toggle logic in jsx/before-after.jsx accordingly.

Test plan

  • All tests/check-*.js pass, including new checks for the button state module
  • tests/photoshop-before-after-audit.jsx on Photoshop 23.2: 8/16-bit, two documents, no-Background document, and save / close / reopen of a PSD (writing the ids adds no History step)
  • Real panel (CDP) on Photoshop 23.2: red state shown while hidden, normal after, follows the active document

…el layers across file reopen

The button turns red with the label 'Anh goc' while the panel layers are hidden, read from the document after each command
and on focus. The recorded layer ids are written to the document XMP so closing and reopening a PSD keeps the comparison.
Whether layers are hidden is derived from layer visibility, not stored state.
… the user hid, cheaper state reads

Stored ids count only while the layer keeps its stored name, so ids reused by other layers after a flatten
or in another file are ignored. Commands that flatten or merge show back only the layers a Before hid, and the
hidden list is stored with the document. State is read per layer id instead of walking every layer, batch commands
skip documents with nothing hidden, and the button also refreshes when the panel opens and when the pointer enters it.
…rs from the recorded list

Pressing Before again after the user turned one panel layer back on no longer forgets the others it had hidden,
so batch, watermark and frame commands still show them. Deleted layers leave the recorded list, which keeps
state reads cheap, and the README notes that undoing the button should be done by pressing it again.
@hongducdev
hongducdev merged commit 209892c into main Nov 8, 2026
1 check passed
@hongducdev
hongducdev deleted the hongducdev/fix/before-after-limits branch November 8, 2026 08:48
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.

1 participant