Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

lockAspectRatio still breaks at independent min/max constraints

未关闭
#277 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@sameerdeolalikar 已经在做这个了。

开始于 2026年9月26日。

  • #278 来自 @sameerdeolalikar —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript
领域
frontend

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
2.6k
派生
373
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

react-grid-layout/react-resizable 的其他 Issue

查看 react-grid-layout/react-resizable 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。