|
@@ -173,7 +173,7 @@ export default {
|
|
switch (ev.key) {
|
|
switch (ev.key) {
|
|
case 'Enter':
|
|
case 'Enter':
|
|
if (!single) { return }
|
|
if (!single) { return }
|
|
- this.nodeInspect(single)
|
|
|
|
|
|
+ this.nodeInspect(single, true)
|
|
break
|
|
break
|
|
case 'Delete':
|
|
case 'Delete':
|
|
if (!this.nodeSelection) { return }
|
|
if (!this.nodeSelection) { return }
|
|
@@ -244,8 +244,22 @@ export default {
|
|
drop: (ev) => {
|
|
drop: (ev) => {
|
|
this.pointerLink.active = false
|
|
this.pointerLink.active = false
|
|
|
|
|
|
- // find Parent
|
|
|
|
|
|
+ console.log('taerget', ev.target)
|
|
|
|
+ if (ev.target.matches('.flow-pan-zoom__transformer')) {
|
|
|
|
+ if (isInput) {
|
|
|
|
+ console.error('Invalid target')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const pt = this.transformedPoint(ev.x, ev.y)
|
|
|
|
+ this.createPortal(nodeId, pt.x, pt.y)
|
|
|
|
+ return
|
|
|
|
+ // Create a thing here
|
|
|
|
+ // if origin socket is an output only
|
|
|
|
+ // Empty drop, try to create a portal here
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ // find Parent
|
|
var curTarget = ev.target
|
|
var curTarget = ev.target
|
|
for (; curTarget.hasAttribute !== undefined && curTarget !== document.body; curTarget = curTarget.parentNode) {
|
|
for (; curTarget.hasAttribute !== undefined && curTarget !== document.body; curTarget = curTarget.parentNode) {
|
|
if (curTarget.hasAttribute('data-nodeid')) {
|
|
if (curTarget.hasAttribute('data-nodeid')) {
|
|
@@ -372,6 +386,7 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // Is this used?
|
|
nodeInspect (tnode, force) {
|
|
nodeInspect (tnode, force) {
|
|
this.$emit('nodeInspect', tnode, force)
|
|
this.$emit('nodeInspect', tnode, force)
|
|
},
|
|
},
|
|
@@ -393,7 +408,6 @@ export default {
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- // this.NODE_INSPECT(tnode.id)
|
|
|
|
this.nodeInspect(tnode)
|
|
this.nodeInspect(tnode)
|
|
|
|
|
|
// Switch selection
|
|
// Switch selection
|
|
@@ -493,7 +507,6 @@ export default {
|
|
viewPointerDown (ev) {
|
|
viewPointerDown (ev) {
|
|
if (ev.button !== 0) return
|
|
if (ev.button !== 0) return
|
|
ev.preventDefault()
|
|
ev.preventDefault()
|
|
- this.nodeSelection = {}
|
|
|
|
const p = this.transformedPoint(ev.x, ev.y)
|
|
const p = this.transformedPoint(ev.x, ev.y)
|
|
this.selector = {x: p.x, y: p.y, width: 0, height: 0}
|
|
this.selector = {x: p.x, y: p.y, width: 0, height: 0}
|
|
utils.createDrag({
|
|
utils.createDrag({
|
|
@@ -511,6 +524,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
drop: (ev) => {
|
|
drop: (ev) => {
|
|
|
|
+ if (!ev.shiftKey) this.nodeSelection = {}
|
|
for (let n in this.nodeData.nodes) {
|
|
for (let n in this.nodeData.nodes) {
|
|
const node = this.nodeData.nodes[n]
|
|
const node = this.nodeData.nodes[n]
|
|
if (node.x > this.selector.x && node.x < (this.selector.x + this.selector.width) &&
|
|
if (node.x > this.selector.x && node.x < (this.selector.x + this.selector.width) &&
|
|
@@ -526,18 +540,29 @@ export default {
|
|
const n = this.nodeData.nodes.find(n => n.src === 'Output')
|
|
const n = this.nodeData.nodes.find(n => n.src === 'Output')
|
|
this.NODE_PROCESS(n.id)
|
|
this.NODE_PROCESS(n.id)
|
|
},
|
|
},
|
|
- createPortal (nodeID) {
|
|
|
|
|
|
+
|
|
|
|
+ createPortal (nodeID, x, y) {
|
|
// Find nodeID
|
|
// Find nodeID
|
|
let node = this.nodeData.nodes.find(n => n.id === nodeID)
|
|
let node = this.nodeData.nodes.find(n => n.id === nodeID)
|
|
if (!node) {
|
|
if (!node) {
|
|
this.NOTIFICATION_ADD('invalid node ID' + nodeID)
|
|
this.NOTIFICATION_ADD('invalid node ID' + nodeID)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ // If nodeID is a portal we recurse back
|
|
|
|
+ if (node.src === 'Portal From') {
|
|
|
|
+ const nodefromId = node.prop['portal from']
|
|
|
|
+ this.createPortal(nodefromId, x, y)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ x = x || node.x + 10
|
|
|
|
+ y = y || node.y + 10
|
|
|
|
+ console.log('X,Y:', x, y, 'nodexy', node.x, node.y)
|
|
// Special node
|
|
// Special node
|
|
const portalNode = {
|
|
const portalNode = {
|
|
id: utils.guid(),
|
|
id: utils.guid(),
|
|
- x: node.x + 10,
|
|
|
|
- y: node.y + 100, // Downthere/improve this
|
|
|
|
|
|
+ x: x,
|
|
|
|
+ y: y, // Downthere/improve this
|
|
defaultInputs: {},
|
|
defaultInputs: {},
|
|
label: node.label,
|
|
label: node.label,
|
|
color: node.color,
|
|
color: node.color,
|