Repository navigation
[DONE] Pattern Lab 에서 매트릭스 크기를 바꾼 뒤에도 픽셀 되돌리기가 그림을 지킨다 - #96
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011kmmYcHXz5CmHbQQyXrdyf
Undo after a matrix resize threw a RangeError (shrink) or wrote old rows across the new width (grow). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011kmmYcHXz5CmHbQQyXrdyf
patternflow-bot
marked this pull request as ready for review
October 16, 2026 15:27
This was referenced Oct 16, 2026
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.
studio / https://claude.ai/code/session_011kmmYcHXz5CmHbQQyXrdyf
Pattern Lab 에서 픽셀을 그리고 매트릭스 크기를 바꾼 뒤 Ctrl+Z 를 누르면, 줄였을 땐 RangeError 로 되돌리기가 멈췄고 키웠을 땐 옛 줄이 새 폭에 밀려 써져 그림이 어긋났어요. 되돌리기 기록이 찍힌 때의 크기를 같이 들고 있다가 크기를 바꿀 때와 같은 꼴(가운데에 맞춰 자르거나 채우기)로 되돌리게 고쳤어요. 머지하면 크기를 바꾼 뒤에도 Ctrl+Z 와 Ctrl+Shift+Z 가 그림을 그대로 지켜요.
좋아지는 것: 크기를 바꾼 뒤에도 픽셀 되돌리기가 맞게 된다 — 그리던 그림이 어긋나거나 멈추지 않는다
할 일
pixelHistory.ts고침과PixelPanel.tsx호출 셋pixelHistory.test.ts일곱,PixelPanel.test.tsx하나한 일
web/src/lib/lab/pixelHistory.ts의 되돌리기 한 칸이 맨 버퍼였는데, 이제{ data, width, height }예요. 되돌리거나 다시 할 때 그 칸의 크기가 지금 레이어와 다르면resizeSurface를 거쳐 넣어요. 크기를 바꿀 때resizePixelLayers가 레이어에 쓰는 바로 그 함수라, 되돌린 그림이 크기를 바꾼 레이어와 같은 자리에 앉아요.PixelPanel.tsx는pixel.data대신pixel을 넘겨요. 세 줄이에요.시험은 둘이에요.
web/src/lib/lab/pixelHistory.test.ts는 줄인 뒤, 키운 뒤, 크기를 바꾸기 앞뒤 칸이 섞인 스택, 되돌리기와 다시 하기 사이의 크기 바꾸기, 40칸 상한, prune 을 봐요.PixelPanel.test.tsx의 「undo still works after the matrix size changes」는 실제 길을 그대로 밟아요. (40, 20) 에 점을 찍고setMatrix로 128×64 를 64×32 로 줄인 뒤 Ctrl+Z, Ctrl+Shift+Z 를 눌러요.증거
고치기 전
dev(c065e13)에서 버리는 재현 시험을 돌렸어요.새 패널 시험을 고치기 전 코드에 돌리면 키 처리기가 던져요.
고친 뒤.
web/에서 다섯을 돌린 끝줄이에요.check:ci안의 Vitest 는Test Files 36 passed (36),Tests 495 passed (495)예요. drift 러너 끝은roadmap하나만skipped이고 나머지 열다섯은passed예요.roadmap은gh로그인이 없는 컨테이너라 건너뛰었고, PR 에서drift.yml이 다시 돌려요.화면 배치는 바뀌지 않아서 390px 와 1440px 사진은 찍지 않았어요. 바뀐 것은 Ctrl+Z 를 누른 뒤 버퍼에 무엇이 들어가는지이고, 패널 시험이 그 버퍼를 읽어요.
실행법
cd web npx vitest run src/lib/lab/pixelHistory.test.ts src/app/pattern-lab/panels/PixelPanel.test.tsx손으로는
npm run dev뒤/pattern-lab에서 픽셀 레이어에 점을 찍고, 매트릭스를 64 × 32 로 줄인 뒤 Ctrl+Z 를 눌러요. 고치기 전엔 콘솔에 RangeError 가 뜨고 점이 남아요.가정
PixelPanel.test.tsx에 시험 하나를 더한 것은 후보의 「고칠 곳」 밖이에요. 버그가 스토어의setMatrix와 되돌리기 기록 사이에서 나서, 그 길을 그대로 밟는 시험이 있어야 다시 깨지지 않는다고 봤어요.Changelog
Web
바퀴
바퀴 1 · 후보 1 「Pattern Lab 에서 매트릭스 크기를 바꾼 뒤에도 픽셀 되돌리기가 그림을 지킨다」
다음 바퀴
/guide/build,/pattern같은 쪽이 링크 미리보기에 그림 없이 나가고,twitter:title은 어느 쪽이든 첫 화면 제목이에요.🤖 Generated with Claude Code
https://claude.ai/code/session_011kmmYcHXz5CmHbQQyXrdyf