Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Resizing a text box by one edge handle incorrectly locks both Max Width and Max Height, silently clipping text

Aberta Para iniciantes
#4,396 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Pouca atividade
Stack de tecnologia
rust

Direção de pesquisa

Comece em editor/src/messages/tool/tool_messages/text_tool.rs, no handler ResizingBounds → PointerMove por volta das linhas 851-920, e leia o TODO próximo. Em seguida, inspecione SelectedEdges em transformation_cage.rs e como new_size() trata arrastos de uma única borda. O trabalho estará concluído quando um arrasto da borda esquerda/direita ativar apenas as restrições de largura, um arrasto da borda superior/inferior ativar apenas as restrições de altura e um arrasto de um canto ativar ambas sem cortar o texto refluído.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Dragging a single edge handle to resize a text layer's bounding box incorrectly enables and locks both the Max Width and Max Height constraints together, even when only one axis was actually resized. Since Max Height causes any text beyond it to not be drawn, this can silently clip text that should still be auto-growing.

Steps to reproduce:

  1. Select the Text tool and click (don't drag) to create point text, then type several lines — this creates auto-sized text with neither Max Width nor Max Height enabled
  2. Switch to resizing and drag only the right-edge handle of the bounding box to set a width (so the text wraps)
  3. Expected: only Max Width becomes active; height keeps auto-growing to fit the rewrapped text
  4. Actual: Max Height also gets switched on and frozen to whatever the box's height happened to be before the rewrap — any lines that end up pushed past that frozen height are silently not drawn

Cause:
In editor/src/messages/tool/tool_messages/text_tool.rs, the ResizingBounds → PointerMove handler (around lines 851-920) unconditionally sets both HasMaxWidthInput/MaxWidthInput and HasMaxHeightInput/MaxHeightInput, regardless of which edge is being dragged. There's actually a TODO comment already sitting right above this code:

// TODO: Don't set both max_width and max_height to true at the same time, only do one based on which edge is being dragged (or both if a corner is being dragged)

The information needed to fix it is already available and just unused: SelectedEdges { top, bottom, left, right } in transformation_cage.rs records exactly which edge(s) are being dragged, and new_size() already leaves size.y untouched (equal to the pre-drag height) when only a left/right edge is dragged — that stale value is what's getting wrongly frozen into MaxHeightInput.

Suggested fix:
Gate the two pairs of SetInput calls on which axis was actually touched, per the existing TODO:

let (touches_width, touches_height) = (movement.left || movement.right, movement.top || movement.bottom);

if touches_width {
    // set HasMaxWidthInput / MaxWidthInput
}
if touches_height {
    // set HasMaxHeightInput / MaxHeightInput
}

A corner-handle drag naturally sets both pairs of edges, so both branches fire together there, matching the "(or both if a corner is being dragged)" note in the TODO.

Linguagem predominante
Rust
Estrelas
27.3k
Forks
1.3k
Merge médio
16h 57min
PRs com merge (30d)
87

Preparar o ambiente

Ainda não verificamos os arquivos de configuração deste projeto. Comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de GraphiteEditor/Graphite

Todas as issues de GraphiteEditor/Graphite

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.