lockAspectRatio still breaks at independent min/max constraints
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start at the lockAspectRatio constraint projection and clamping logic in the current implementation, then run the focused regression test described in the issue. Verify width and height minimum and maximum bounds, overshoot/return, and a subsequent gesture preserve the aspect ratio when possible. Confirm the incompatible-bounds control still gives size constraints precedence.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With lockAspectRatio enabled, independently calculated width and height constraints can still change the aspect ratio on current master (c6fd4ab8d3d4e9c0707c2bbb6d47d0fcbdb5e6b9, 4.0.2).
For example, start at 300 × 150 (2:1), set minConstraints={[100, 50]} and maxConstraints={[420, 400]}, then drag the southeast handle toward 600 × 300. The current result is 420 × 300 rather than 420 × 210. The width and height are clamped independently after projection onto the ratio line. With a controlled component, that changed ratio also becomes the next resize's input ratio.
Expected: when a size satisfying both bounds and the ratio exists, keep the ratio and choose that size. If the bounds make the ratio impossible, retain size-constraint precedence rather than exceeding a bound.
Related historical report: #51. The current implementation still reproduces this despite the later projection rewrite. I have a focused regression test covering width/height minimum and maximum bounds, overshoot/return and a subsequent gesture. Five new tests fail on unchanged master; the incompatible-bounds control passes.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.6k
- Fork
- 373
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react-grid-layout/react-resizable
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
react-grid-layout/react-resizable#237 · 8 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
react-grid-layout/react-resizable#222 · 4 bình luận ·
Tất cả issue của react-grid-layout/react-resizable