This commit is contained in:
2020-12-04 02:00:23 +01:00
parent ff1ed77907
commit 6ea50532cc
5 changed files with 102 additions and 65 deletions

View File

@@ -36,9 +36,9 @@ export default {
type: Object,
default() {
return {
centerX: 1024,
centerX: 0,
scale: 1,
centerY: 140,
centerY: 0,
nodes: [],
links: [],
}
@@ -125,19 +125,23 @@ export default {
})
},
getPortPosition(type, x, y) {
// Line start and end points set here
if (type === 'top') {
return [x + 40, y];
return [x + 100, y];
}
else if (type === 'bottom') {
return [x + 40, y + 80];
return [x + 100, y + 150];
}
},
linkingStart(index) {
this.action.linking = true;
// Dirty fix, so that links won't glitch when being created
const node = this.findNodeWithID(index);
const [x,y] = this.getPortPosition('bottom',node.x + this.scene.centerX,node.y + this.scene.centerY);
this.draggingLink = {
from: index,
mx: 0,
my: 0,
mx: x, // Yes, those are magic numbers
my: y,
};
},
linkingStop(index) {