Skip to content

사각형 글상자 안 picture 클릭 hit-test / 속성 / 삽입 지원 (#1171)#1254

Merged
edwardkim merged 7 commits into
edwardkim:develfrom
johndoekim:fix/issue-1171
Jun 2, 2026
Merged

사각형 글상자 안 picture 클릭 hit-test / 속성 / 삽입 지원 (#1171)#1254
edwardkim merged 7 commits into
edwardkim:develfrom
johndoekim:fix/issue-1171

Conversation

@johndoekim

Copy link
Copy Markdown
Contributor

배경

samples/tac-img-02.hwp 6/7쪽의 "사각형(Shape, InFrontOfText) → 글상자(text_box) → paragraph → picture" 이중 중첩 picture가 rhwp-studio에서 클릭·선택·속성편집되지 않았습니다 (#1171). 작업 중 발견된 "글상자 위 이미지 드롭 시 삽입 실패"(별개 결함)도 함께 처리했습니다.

접근 — cellPath 일반화

글상자를 "cell_index=0 sentinel 단일 셀 컨테이너"로 취급하여, 표 셀 picture가 이미 쓰던 cellPath 메커니즘을 글상자까지 확장했습니다. text/equation/table은 이미 이 방식을 사용하고 있었고 picture만 누락되어 있었습니다 (신규 평행 메커니즘 없음).

변경 요약

백엔드

  • src/renderer/layout/shape_layout.rs: 글상자 picture의 layout_pictureCellContext(sentinel) 전달.
  • src/document_core/queries/rendering.rs collect_controls: 사각형(Rectangle) 노드 조기 return 제거 → Table 처럼 자식 재귀하여 글상자 내부 picture 수집.
  • src/document_core/commands/object_ops.rs: by_path picture getter/setter 가 글상자 path도 해석 (resolver 를 immutable 짝과 대칭화).

프런트엔드 (rhwp-studio)

  • input-handler-mouse.ts: 글상자 내부 클릭이 텍스트 편집으로 단락되기 전 picture 선제 hit-test (picture 우선).
  • input-handler-picture.ts findPictureAtClick: 컨테이너 Shape + nested picture 동시 hit 시 picture 우선 반환.
  • input-handler-table.ts: 글상자 위 이미지 드롭은 본문(body) floating sibling 으로 삽입 (한컴 정합).

검증

  • cargo fmt --all -- --check
  • cargo clippy --lib -- -D warnings ✓ (경고 0건)
  • cargo test ✓ (1948 passed / 0 failed) — 신규 tests/issue_1171_textbox_picture_cellpath.rs(cellPath 노출 + by_path get/set round-trip) 포함, 표 셀 by_path 회귀 0.
  • E2E (headless Chrome): rhwp-studio/e2e/textbox-picture-1171.test.mjs(선택/속성), textbox-picture-insert-1171.test.mjs(드롭→본문 sibling, TDD red→green).
  • 시각/한컴 정합: 글상자 picture 선택·속성, 글상자 위 이미지 = 본문 floating sibling(글상자 뒤). 검증 환경: macOS, 한컴 직접 비교 확인. (본 시나리오는 편집 중 동작이라 권위 PDF 대상 아님.)

범위 밖 (후속)

  • 글상자 안 중첩 도형(shape) get 정합, 다단계 중첩 insert.ts 견고화, 글상자 내부 콘텐츠로서 이미지 삽입.

Closes #1171

🤖 Generated with Claude Code

johndoekim and others added 7 commits June 2, 2026 22:38
사각형 글상자(Shape text_box) 안 picture click hit-test / 속성 지원.
- 접근 B(cellPath 일반화) + picture 우선 UX 확정
- 5단계 구현계획서, 오늘 할일 등록

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
사각형(Shape) text_box 안 picture 가 controls JSON 에 cellPath
(cell_index=0 sentinel)로 노출되도록 식별자 생성.

- shape_layout.rs: Control::Picture 분기에 CellContext 전달
  (text-run/equation/table 와 동일 sentinel 패턴, None→Some)
- rendering.rs collect_controls: Rectangle(Shape) 핸들러 조기 return
  제거 → Table 처럼 자식 재귀하여 글상자 내부 picture 수집 (계획 외 발견)
- 신규 테스트 issue_1171_textbox_picture_cellpath
- 전체 cargo test 1947 passed / 0 failed

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
글상자(Shape text_box) path(cell_index=0 sentinel)로 picture 속성
read/write 가능하도록 resolver 정합.

- getter: resolve_cell_by_path → resolve_paragraph_by_path (표/글상자 모두 처리)
- setter 공통 헬퍼 resolve_cell_paragraph_mut 에 Shape arm 추가
  (immutable 짝 resolve_paragraph_by_path 와 대칭화, get_textbox_from_shape_mut)
- 신규 round-trip 테스트 picture_in_textbox_get_set_by_path
- cargo test --lib 1527 passed / 0 failed (표 셀 by_path 회귀 0)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
글상자(Shape text_box) 내부 클릭이 텍스트 편집으로 단락되기 전에
글상자 안 picture 를 선제 hit-test 하여 picture 객체선택 (picture 우선).

- input-handler-mouse.ts: hit.isTextBox 시 findPictureAtClick 선제 호출,
  cellPath 동반 image/equation 이면 enterPictureObjectSelectionDirect 로
  dispatch 후 return. picture 없으면 텍스트 편집 fall-through.
- tsc 변경 파일 에러 0. 행위 검증은 Stage 5 (WASM 재빌드 후).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
E2E 검증 중 findPictureAtClick 이 글상자 picture bbox 에서 컨테이너
Shape 를 먼저 반환하는 결함 확인 → 우선순위 수정.

- input-handler-picture.ts: findPictureAtClick 선두에 우선 패스 추가.
  클릭이 Shape + cellPath nested image/equation 둘 다 hit 시 picture 우선
  (shapeHit && nestedPic 일 때만 동작 → 표 셀 picture 무영향).
- 신규 E2E textbox-picture-1171: cellPath 노출 + hit-test(image) +
  by_path round-trip(width 15040→20040) 통과.
- Stage 4 결론: insert.ts 무변경 (depth-1 재구성이 글상자 cellPath 생성, E2E 확정).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
글상자(Shape text_box) 위에 이미지 드롭 시 삽입 실패(controls[N]가 표가
아닙니다) 수정. 한컴처럼 본문 레벨 floating 개체(글상자 sibling)로 삽입.

- 원인(pre-existing): 글상자 hit 의 cellPath(sentinel)를 insertPicture 에
  넘겨 표 전용 resolve_cell_by_path 가 거부 → 삽입 실패.
- finishImagePlacement: 글상자(isTextBox) hit 은 cellPath 없이 본문
  para(parentParaIndex)에 floating 삽입. 표 셀(edwardkim#1151)/본문은 불변.
- 신규 E2E textbox-picture-insert-1171 (TDD red→green; before0→after1,
  treat_as_char=false floating, shape 독립 — 한컴 정합 확인).
- 작업지시자 실환경 한컴 정합 확인 완료.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cellPath 일반화로 글상자 picture hit-test/속성(Stage1-4) + 글상자 위
이미지 드롭 본문 sibling 삽입(Stage6). cargo test 1948 pass, E2E pass,
한컴 정합 확인.

orders 는 작업지시자(메인테이너) 영역이라 컨트리뷰터 추가분 원복.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@edwardkim edwardkim self-requested a review June 2, 2026 22:23
@edwardkim edwardkim added the bug Something isn't working label Jun 2, 2026
@edwardkim edwardkim added this to the v1.0.0 milestone Jun 2, 2026
@edwardkim edwardkim merged commit 47cd32d into edwardkim:devel Jun 2, 2026
7 checks passed
@edwardkim

Copy link
Copy Markdown
Owner

PR #1254 검토 및 메인테이너 검증을 완료했습니다.

반영 내용:

  • 글상자 내부 picture 선택/속성 조회/수정 지원
  • 글상자 내부 picture 삭제/크기 조정 시 cellPath by-path 경로 유지
  • 글상자 위 이미지 드롭 시 한컴 동작과 동일하게 본문 floating sibling으로 삽입
  • WASM wrapper 및 rhwp-studio public 번들 동기화

추가 보완:

  • 선택 이후 Delete/Cut/Resize/Command/History 경로에서 cellPath가 누락되어 발생하던 콘솔 오류를 수정했습니다.
  • deleteCellPictureControlByPath WASM/Rust API를 추가했습니다.

검증:

검증 완료 커밋은 5453b254이며, 원격 devel에 push했습니다. 기여 감사합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants