Skip to content

fix: 이미지(Picture) 회전/대칭 버튼 동작 (#831)#835

Open
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/picture-rotate-flip
Open

fix: 이미지(Picture) 회전/대칭 버튼 동작 (#831)#835
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/picture-rotate-flip

Conversation

@oksure
Copy link
Copy Markdown
Contributor

@oksure oksure commented May 11, 2026

변경 내용

Closes #831

도구 상자의 회전/대칭 4개 버튼(insert:rotate-cw, insert:rotate-ccw, insert:flip-horz, insert:flip-vert)이 이미지(Picture) 객체에서도 동작하도록 수정합니다.

원인

applyRotationDelta()toggleFlip()에서 ref.type !== 'shape' 가드로 인해 shape 이외의 객체 타입이 모두 차단되었습니다. getProps()/setProps() 헬퍼는 이미 image 경로(getPictureProperties/setPictureProperties)를 지원합니다.

수정

  • ref.type !== 'shape'ref.type === 'equation' || ref.type === 'group'
  • 수식(equation)과 그룹(group)만 제외, image/line 등 허용

테스트

  • cargo test 통과
  • cargo clippy -- -D warnings 경고 없음

감사합니다.

- applyRotationDelta: ref.type !== 'shape' → equation/group만 제외
- toggleFlip: 동일하게 image 타입 허용
- getProps/setProps가 이미 image path를 지원하므로 가드만 완화
Copilot AI review requested due to automatic review settings May 11, 2026 10:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the rotate/flip command handlers in rhwp-studio so that toolbar commands (insert:rotate-cw, insert:rotate-ccw, insert:flip-horz, insert:flip-vert) work for Picture (image) objects, not only shapes, by relaxing the selection-type guard conditions.

Changes:

  • Loosened guards in applyRotationDelta() / toggleFlip() to allow non-shape object types (excluding equation and group).
  • Updated function docstrings to remove the “Shape only” limitation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 383 to 387
const ref = ih.getSelectedPictureRef();
if (!ref || ref.type !== 'shape') return;
if (!ref || ref.type === 'equation' || ref.type === 'group') return;
const props = getProps(services, ref);
const cur = ((props.rotationAngle as number) ?? 0);
let next = cur + delta;
Comment on lines 399 to 403
const ref = ih.getSelectedPictureRef();
if (!ref || ref.type !== 'shape') return;
if (!ref || ref.type === 'equation' || ref.type === 'group') return;
const props = getProps(services, ref);
const cur = !!props[key];
setProps(services, ref, { [key]: !cur });
getProps/setProps가 line 컨트롤에 대해 getPictureProperties를
호출하면 에러 발생. line도 equation/group과 함께 제외.
@oksure
Copy link
Copy Markdown
Contributor Author

oksure commented May 11, 2026

Copilot 리뷰 반영 (95b8e67): line 타입도 제외 (getProps가 getPictureProperties를 호출하여 에러 발생)

@jangster77
Copy link
Copy Markdown
Contributor

엄청 빠르시네요. 감사합니다.

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.

3 participants