GraphiteEditor / GraphiteEditor/Graphite

Prevent the layer tree from allowing layer drag group formation of incompatible types

Abierto
#2,219 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Paper Cut
Lenguaje dominante
Rust
Estrellas
27.2k
Forks
1.3k
Merge medio
20 h 5 min
PR fusionados (30 d)
57

Descripción

We display a grayed out expansion arrow for empty layers. This also means other layers can be dragged into that layer, becoming a child.

![Image](https://github.com/user-attachments/assets/ab098d1f-950e-4c6a-949c-e2cf4b224b7f)

That's because we want to indicate to users that this potentially could have a child. If it gains a child, it would become a group and the expansion arrow would get un-grayed out. Or, it can become a content layer fed by a chain starting with a generator node, in which case it can't gain a child.

But there is confusing behavior with the Path node, since it isn't a generator node. That is, it takes an optional primary input. Since now it becomes possible to attach a child layer to the start of that chain (feeding into the Path node), we display the grayed out expansion arrow. However, the user won't ever be dragging one layer (which outputs group data) into the layer (since the Path node takes vector data).

However, if it's just a Transform node feeding into the otherwise empty layer, that chain has no content. It still makes perfect sense to drag another layer into this layer to turn it into a group (which is transformed by the Transform node).

So there are two situations here:
- The layer's left input at the start of the node chain accepts group input (such as no chain, or the Transform node, or the Flatten Vector Elements node). Keep the current behavior with the grayed out expansion arrow and ability to drag layers into it.
- The Path node doesn't (currently) accept group data. Upon dragging another layer into the vector data layer, this becomes a type error (but this will change with #1822, negating this specific example, but there will be other examples this concept should still be implemented for). So we don't want to allow dragging layers (which output group data) into a node which begins with the Path node, or any other node with a primary input incompatible with group data. In that case, the grayed out expansion arrow shouldn't show in the Layers panel, and users shouldn't be able to drag a layer into it. (In the future, if we have layers that output a specific other type besides group, we should aim to allow dragging compatible types into compatible inputs even if they don't show the grayed out expansion arrow normally.) This change will prevent the user from using the WYSIWYG tooling to break the graph (which should be considered a bug: #2214).

Lastly, when reordering layers by dragging them around in the Layers panel, we want to turn the insertion bar red if the type would be invalid, causing a graph error.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

No files, tests, or entry points are named. Trace layer-tree drag grouping and layer reordering validation, then verify that group-incompatible primary inputs suppress the grayed arrow, reject drops, and show a red insertion bar; account for the Transform and Flatten Vector Elements cases described in the issue.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
computer-graphics, frontend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.