fix(document_core): clamp shape width/height to prevent disappearance on resize#163
Merged
Merged
Conversation
… on resize studio가 리사이즈 핸들을 반대편 너머로 끌어당길 때 setShapeProperties 에 width/height=0 을 전송하면 아래와 같이 도형이 시각적으로 사라진다: - Rectangle: x_coords = [0, 0, 0, 0] / y_coords = [0, 0, 0, 0] 로 붕괴 - Group: current_width/original_width 비율이 0 이 되어 모든 자식이 0배 렌더링 - IR 자체는 남아 있으나 렌더러 출력이 비어 "지워진 것처럼" 보임 MDM 프로젝트에서 사용자 피드백으로 재현. 영상: 도형 리사이즈 핸들을 여러 번 클릭하다 보면 도형이 갑자기 사라지고, studio 쪽 Ctrl+Z 가 중간 0-width 상태를 스냅샷으로 잡지 못해 되돌리기도 불가. table_ops 의 MIN_CELL_SIZE (200 HWPUNIT ≈ 0.7mm) 전례를 따라 MIN_SHAPE_SIZE=200 으로 clamp. apply_common_obj_attr_from_json 과 set_shape_properties_native 두 지점 모두 방어한다. 회귀 테스트 3개 추가 (resize_clamp_tests): - resize_to_zero_width_clamps_to_min - rectangle_coords_nonzero_after_shrink_to_zero - repeated_zero_resize_does_not_corrupt_state
edwardkim
added a commit
that referenced
this pull request
Apr 19, 2026
본 v0.5.0 → v0.7.3 (라이브러리) / 0.2.0 (확장) 배포 주기에 머지된 외부 기여자 6명을 README 3개 변경 이력에 추가: - @ahnbu — Ctrl+S file handle (PR #189, 기명시) - @bapdodi — 회전 도형 리사이즈 + Flip (PR #192) - @dreamworker0 — Windows CFB 경로 (PR #152) - @marsimon — HWP 그림 효과 SVG (PR #149) - @postmelee — 썸네일 + options CSP (PR #168) - @seunghan91 — HWPX Serializer + 다수 (PR #170, #161, #163, #153, #154) 각 README 끝에 "기여자 감사" 섹션 추가 — 6명 일괄 인정. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
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.
Closes #162.
배경
MDM 데스크톱 앱에서 사용자 피드백으로 재현된 버그 수정입니다. HWP 문서의 도형 리사이즈 핸들을 반대편 너머로 여러 번 드래그하면 studio가 `setShapeProperties` 에 `width=0` / `height=0` 을 보내고, 코어가 이를 그대로 받아 도형이 시각적으로 사라지는 문제입니다 (IR은 남아 있음).
상세 분석은 이슈 #162 참고.
변경 요약
`document_core/commands/object_ops.rs` 에만 국한된 surgical fix입니다.
테스트
`resize_clamp_tests` 모듈에 회귀 테스트 3개 추가:
로컬 검증: `cargo test --lib resize_clamp` 3/3 통과, `cargo test --lib object_ops` / `cargo test --lib shape` 전체 통과, `cargo check` 경고 없음.
범위 외 (별도 이슈 권장)
Ctrl+Z 가 studio 측에서 동작하지 않는 문제는 `save_snapshot_native` 호출 시점 이슈로 보입니다. studio 레벨이라 이 PR 범위에서 제외했습니다. 필요하시면 별도 이슈 열겠습니다.
이전 기여 맥락
기존 MDM→rhwp 역기여 (#153, #154) 의 연장선입니다.