Repository navigation
feat(shapes): group pictures, text boxes, lines and groups inside groups - #438
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ix and module ownership Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, refresh the manual hashes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
리뷰 결과: 머지 전에 고칠 것 하나, 나머지는 좋습니다. 고칠 것: 같은 부재를 다시 쓰면 묶음 안 묶음의 도형이 두 번 옮겨진다
inner = M.group(1000, 1000, [M.rect(0, 0, 500, 500)])
members = [M.rect(0, 0, 3000, 3000), inner]
doc.shapes.add_container(members) # 안쪽 사각형 offset (1000, 1000)
doc.shapes.add_container(members) # 안쪽 사각형 offset (2000, 2000) — 묶음 상자 밖같은 안쪽 묶음을 한 묶음에 두 번 넣어도( 제안: 묶음을 조립할 때 부재 요소를 복사해서(안쪽 묶음은 확인한 것
막지 않는 것(원하면 같이)
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
다시 리뷰: 병합합니다.
|
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.
바뀐 점
묶음(
doc.shapes.add_container)에 선·글상자·그림·묶음 안 묶음 부재를 더한다. 지금까지 부재는 사각형·타원·다각형뿐이었지만, 한/글 문서의 묶음은 대부분 그림과 글상자를 함께 담고, 묶음 안에 묶음을 둔 것도 흔하다.한/글의 동작
sz·pos·outMargin·shapeComment)가 없다.id·zOrder는 0,numberingType은NONE,textWrap은TOP_AND_BOTTOM이고,groupLevel은 깊이(1, 2, 3…)다.numberingType="PICTURE"를 가진다.transMatrix**에 그린다. 그래서 묶음 안 묶음의 부재도 바깥 묶음 좌표로 저장된다. 안쪽 묶음 좌표에 두면 한/글은 그 도형을 바깥 묶음의 왼쪽 위에 겹쳐 그린다.img·imgRect·imgClip·inMargin·imgDim·effects를 지니고, 글상자 부재는 모서리 점 앞에drawText를 둔다.코드
oxml/container.py새 모듈.objects.py가 1,600줄 상한에 닿아,ContainerMember와 묶음 조립을 옮겼다.objects는ContainerMember·_create_container_element를 다시 내보내고, 도형 빌더는 쓰는 곳에서 불러와 어느 모듈을 먼저 import해도 된다.ContainerMember.line(start_x, start_y, end_x, end_y): 두 끝 중 왼쪽 위에 놓이고, 두 끝을 그 모서리 기준으로 지닌다.ContainerMember.text_box(x, y, width, height, text, ...): 사각형에set_draw_text와 같은 글을 담는다(이름·편집 가능·여백·글자 모양·문단 모양·세로 정렬). 글은 묶음이 구역에 들어간 뒤 쓰여 문단 id가 구역에서 겹치지 않는다. 잘못된 세로 정렬은 문서를 바꾸기 전에 거부한다.ContainerMember.picture(x, y, width, height, image):doc.media.add_image가 돌려준 이진 항목(또는 그 id)을 받는다. 비면shape-container-picture-image로 거부한다.ContainerMember.group(x, y, members): 묶음 안 묶음. 놓이는 자리만큼 모든 하위 도형의offset과transMatrix를 옮겨, 가장 바깥 묶음 좌표에 둔다.zOrder="0"·numberingType="NONE"을 쓰고, 묶음을 다 만든 뒤groupLevel을 깊이로 매긴다.objects.py: 문단add_container가 묶음을 넣은 뒤 글상자 부재의 글을 쓴다. 넣을 때 요소가 복사되므로, 넣은 묶음의 부재를 순서대로 짝짓는다.module-ownership.json, 문서 해시 원장을 고쳤다.import hwpx가 읽는 모듈 수 상한은 98에서 99로, 분류 모듈 수는 181에서 182로 바뀐다. 새 모듈이objects와 함께 읽히기 때문이다.테스트
tests/test_container_members.py(새 파일)drawText위치,lastWidth, 세로 정렬·여백, 구역 안 문단 id 중복 없음groupLevel, 부재 속성, 크기, 그리고 하위 도형이 바깥 묶음 좌표로 옮겨지는지tests/test_container_authoring.py는 그대로 통과한다.🤖 Generated with Claude Code