-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add figure reference links, panel jumps, and crop flow #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
enu3379
wants to merge
9
commits into
dev
Choose a base branch
from
feature/figure-ux
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
84fc32f
Implement figure UX links jumps and crop flow
enu3379 1f711a4
Record figure UX review results and amend panel pin rule
enu3379 4960fe6
Update progress after PR #5 merge and figure-ux rebase
enu3379 65371e2
Fix doubled text over figure references in the text layer
enu3379 cf39864
Fix caption labels leaking into figure mention chips
enu3379 49e24ee
Add origin chip for embedded figure links (FG-R1)
enu3379 6fb1b66
Record FG-R1 completion and dev rebase in figure UX docs
enu3379 db4be82
Keep panel open on figure card jump regardless of pin (QA F1)
enu3379 8ae72a4
Record real-device QA results for figure UX (section 7.1)
enu3379 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import type { FigureEntry } from './types'; | ||
|
|
||
| export type CaptionMatch = { | ||
| page: number; | ||
| start: number; | ||
| end: number; | ||
| }; | ||
|
|
||
| type NormalizedText = { | ||
| text: string; | ||
| map: number[]; | ||
| }; | ||
|
|
||
| export function findCaptionAnchor(page: number, pageText: string, captionText: string): CaptionMatch | undefined { | ||
| const exactStart = pageText.indexOf(captionText); | ||
| if (exactStart >= 0) { | ||
| return { page, start: exactStart, end: exactStart + captionText.length }; | ||
| } | ||
|
|
||
| const haystack = normalizeSearchText(pageText); | ||
| const needle = normalizeSearchText(captionText); | ||
| if (!needle.text) return undefined; | ||
|
|
||
| const normalizedStart = haystack.text.indexOf(needle.text); | ||
| if (normalizedStart < 0) return undefined; | ||
|
|
||
| const normalizedEnd = normalizedStart + needle.text.length - 1; | ||
| const start = haystack.map[normalizedStart]; | ||
| const end = (haystack.map[normalizedEnd] ?? start) + 1; | ||
| return { page, start, end }; | ||
| } | ||
|
|
||
| export function mergeFigureEntries(existing: FigureEntry[], incoming: FigureEntry[]): FigureEntry[] { | ||
| const existingById = new Map(existing.map((figure) => [figure.id, figure])); | ||
| const seen = new Set<string>(); | ||
| const merged = incoming.map((figure) => { | ||
| seen.add(figure.id); | ||
| const previous = existingById.get(figure.id); | ||
| if (previous?.regionSource === 'manual' && previous.region) { | ||
| return { | ||
| ...figure, | ||
| region: previous.region, | ||
| regionSource: 'manual' as const, | ||
| confidence: Math.max(previous.confidence, figure.confidence) | ||
| }; | ||
| } | ||
| return figure; | ||
| }); | ||
|
|
||
| for (const previous of existing) { | ||
| if (previous.regionSource === 'manual' && !seen.has(previous.id)) { | ||
| merged.push(previous); | ||
| } | ||
| } | ||
| return merged.sort((a, b) => a.page - b.page || a.kind.localeCompare(b.kind) || naturalNumberCompare(a.num, b.num)); | ||
| } | ||
|
|
||
| function naturalNumberCompare(left: string, right: string): number { | ||
| return left.localeCompare(right, undefined, { numeric: true, sensitivity: 'base' }); | ||
| } | ||
|
|
||
| // 스캔 텍스트는 pdf.js 아이템을 구분자 없이 이어 붙여 공백 유무가 불안정하다 | ||
| // (예: "threereviewers"). 엔진 캡션과의 대조는 공백을 아예 무시하고 한다. | ||
| function normalizeSearchText(value: string): NormalizedText { | ||
| const chars: string[] = []; | ||
| const map: number[] = []; | ||
|
|
||
| for (let index = 0; index < value.length; index += 1) { | ||
| const char = value[index]; | ||
| if (/\s/.test(char)) continue; | ||
| chars.push(char.toLocaleLowerCase()); | ||
| map.push(index); | ||
| } | ||
|
|
||
| return { text: chars.join(''), map }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
R8(27행대) 규칙이 이번에 갱신된 크롭 진입 방식과 불일치.
이 구간에서 크롭 진입을 "카드 이미지 우상단 호버 크롭 아이콘"으로 명시했고 289행의 §8도 같은 방식으로 갱신됐지만, 상단의 상호작용 규칙 R8(변경되지 않은 27-41행 구간)은 여전히 "그림·표 탭의 '영역 지정' 버튼으로 진입"이라고 서술되어 있습니다.
figure-ux.md도 "§8의 '영역 지정/다시 지정' 텍스트 버튼은 아이콘으로 대체... 계획서 §8 서술 개정 필요(G8)"라고 명시했는데, §8은 갱신됐으나 R8은 빠진 것으로 보입니다. R8 문구도 아이콘 진입 방식으로 맞춰주세요.🤖 Prompt for AI Agents