Improve auto-linking of layers dragged onto links
This commit is contained in:
parent
60a9c27bf1
commit
747dae3bb6
|
|
@ -589,6 +589,8 @@
|
||||||
.shelf {
|
.shelf {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
// A precaution in case the variables above somehow fail
|
||||||
|
max-width: calc(32px * 3);
|
||||||
|
|
||||||
.tools {
|
.tools {
|
||||||
flex: 0 1 auto;
|
flex: 0 1 auto;
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@
|
||||||
const theNodesContainer = nodesContainer;
|
const theNodesContainer = nodesContainer;
|
||||||
|
|
||||||
// Find the link that the node has been dragged on top of
|
// 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);
|
const { nodeInput, nodeOutput } = resolveLink(link);
|
||||||
if (!nodeInput || !nodeOutput) return false;
|
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 the node has been dragged on top of the link then connect it into the middle.
|
||||||
if (link) {
|
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.connectNodesByLink(selectedNodeId, 0, link.linkEnd, Number(link.linkEndInputIndex));
|
||||||
editor.instance.shiftNode(selectedNodeId);
|
if (!isLayer) editor.instance.shiftNode(selectedNodeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function pointerUp(e: PointerEvent) {
|
function pointerUp(e: PointerEvent) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue