fix: 이미지(Picture) 회전/대칭 버튼 동작 (#831)#835
Open
oksure wants to merge 2 commits into
Open
Conversation
- applyRotationDelta: ref.type !== 'shape' → equation/group만 제외 - toggleFlip: 동일하게 image 타입 허용 - getProps/setProps가 이미 image path를 지원하므로 가드만 완화
Contributor
There was a problem hiding this comment.
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 (excludingequationandgroup). - 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과 함께 제외.
Contributor
Author
|
Copilot 리뷰 반영 (95b8e67): line 타입도 제외 (getProps가 getPictureProperties를 호출하여 에러 발생) |
Contributor
|
엄청 빠르시네요. 감사합니다. |
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 #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'테스트
cargo test통과cargo clippy -- -D warnings경고 없음감사합니다.