mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Improve auto-linking of layers dragged onto links
This commit is contained in:
parent
60a9c27bf1
commit
747dae3bb6
2 changed files with 7 additions and 3 deletions
|
@ -589,6 +589,8 @@
|
|||
.shelf {
|
||||
flex: 0 0 auto;
|
||||
justify-content: space-between;
|
||||
// A precaution in case the variables above somehow fail
|
||||
max-width: calc(32px * 3);
|
||||
|
||||
.tools {
|
||||
flex: 0 1 auto;
|
||||
|
|
|
@ -466,7 +466,7 @@
|
|||
const theNodesContainer = nodesContainer;
|
||||
|
||||
// Find the link that the node has been dragged on top of
|
||||
const link = $nodeGraph.links.find((link): boolean => {
|
||||
const link = $nodeGraph.links.find((link) => {
|
||||
const { nodeInput, nodeOutput } = resolveLink(link);
|
||||
if (!nodeInput || !nodeOutput) return false;
|
||||
|
||||
|
@ -487,9 +487,11 @@
|
|||
|
||||
// If the node has been dragged on top of the link then connect it into the middle.
|
||||
if (link) {
|
||||
editor.instance.connectNodesByLink(link.linkStart, 0, selectedNodeId, 0);
|
||||
const isLayer = $nodeGraph.nodes.find((node) => node.id === selectedNodeId)?.isLayer;
|
||||
|
||||
editor.instance.connectNodesByLink(link.linkStart, 0, selectedNodeId, isLayer ? 1 : 0);
|
||||
editor.instance.connectNodesByLink(selectedNodeId, 0, link.linkEnd, Number(link.linkEndInputIndex));
|
||||
editor.instance.shiftNode(selectedNodeId);
|
||||
if (!isLayer) editor.instance.shiftNode(selectedNodeId);
|
||||
}
|
||||
}
|
||||
function pointerUp(e: PointerEvent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue