Repository navigation
fix: 사진 크롭 틀 드래그 시 clamp 예외 — 부동소수점 오차로 상한<하한 - #326
Merged
Merged
Conversation
3:4 보다 넓은 사진(가로·정사각형)은 크롭 틀 높이가 사진 높이와 같아 top.clamp(사진 위, 사진 아래 - 틀 높이) 의 하한·상한이 이론상 같다. 부동소수점 오차로 상한이 하한보다 아주 조금 작아지는 배치에서 clamp 가 ArgumentError 를 던져 드래그 프레임마다 보고되고(10-25 iOS 1초 30건, flutter.gesture), 그 프레임엔 틀도 움직이지 않았다. 상한을 하한 아래로 내려가지 않게 막고, 여러 화면 높이 × 4:3·1:1·16:9 사진으로 드래그하는 위젯 회귀 테스트를 추가했다(수정 전 1:1 에서 재현). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
전체 라인 커버리지: 25.0% (5286/21105) 이 PR 의 변경 파일:
|
seizeh
added a commit
that referenced
this pull request
Oct 27, 2026
`sort -rn | head -1` 은 head 가 첫 줄만 읽고 먼저 끝나면 sort 가 Broken pipe 로 종료 코드 2 를 내고, pipefail 때문에 줄 수와 무관하게 검사가 실패했다(PR #326 첫 실행, 재실행으로 통과). 최댓값을 awk 하나로 고르도록 바꿨다. 함께: xargs 가 wc 를 여러 번 나눠 실행하면 합계 줄이 여러 개 생겨 `sed '$d'` 로는 마지막 하나만 지워지고 합계가 최댓값으로 뽑힌다 (xargs -n 20 으로 재현: "10924 total"). 합계 줄은 이름으로 거른다. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
무슨 일이 있었나
관리자 콘솔 오류 알림: 10-25 14:49 KST, iOS 기기 한 대(내부 계정)에서
flutter.gesture오류가 1초 동안 30건 기록됐다.게시글 작성·수정 때 나오는 "보여질 영역 조정" 화면에서 3:4 틀을 끌 때 생긴다. 앱이 죽지는 않지만, 예외가 난 프레임에서는 틀이 움직이지 않아 끌리지 않고 멈춘 것처럼 보인다.
원인
3:4보다 넓은 사진(가로·정사각형)은 틀 높이가 사진 높이와 같다. 그래서
top.clamp(사진 위, 사진 아래 - 틀 높이)의 하한과 상한이 이론상 같다. 그런데Rect연산(fromCenter·shift·height = bottom - top)의 반올림 오차로 상한이 하한보다 아주 조금 작아지는 배치가 있고, 이때clamp가ArgumentError(하한)를 던진다. 화면 높이를 바꿔 가며 시뮬레이션하면, 넓은 사진일 때 약 3분의 1의 배치에서 드래그 중 이 예외가 난다.수정
_clampInside: 상한을math.max(하한, 상한)으로 바꿔 하한 아래로 내려가지 않게 했다(가로·세로 모두).test/image_crop_clamp_test.dart: 화면 높이 24가지 × 4:3·1:1·16:9 사진으로 초기(최대) 틀을 1/3pt씩 드래그한다. 예외가 없고 틀이 실제로 움직이는지 확인한다.Invalid argument(s): …가 여러 높이에서 재현됨(실패)검증
flutter analyze통과flutter test전체 369개 통과🤖 Generated with Claude Code