Commit d61d759e authored by Adam Procter's avatar Adam Procter

closer

parent de5d9d45
Pipeline #223 failed with stages
in 1 minute and 23 seconds
......@@ -65,20 +65,48 @@ export default {
var index = 0;
var colours = ["red", "green", "blue", "yellow", "cyan"];
var objectsProcessed = 0;
// when fired loops through applying all the positions if id matches
// needs to be running this update in Realtime to update moves
// maybe in watch: { } ??? function ???
// FIXMEneed to make arrow function
nodes.on("startyourpositions", event => {
console.log("hit");
//console.log(nodes)
// data2.forEach(element => {
// // console.log(element.id);
// // console.log(element.xpos);
// // console.log(element.ypos);
// // now use SVG.get for the dom and look for matching g id and move that to location
// if (element.id == SVG.get(element.id)){
// SVG.get(element.id).animate().move(element.xpos,element.ypos)
// }
// });
data2.forEach(
element => {if (element.id == SVG.get(element.id))
element.animate().move(element.xpos,element.ypos)
}
);
});
// loops through all the objects and renders them
// loops through all the objects and renders them
data.forEach(element => {
//index = index + 20
knowledgeObj = nodes
.group()
.draggy({ minX: 0, minY: 0, maxX: 600, maxY: 300 });
// assigns group <g id="id" of the unique id in database
// assigns group <g id="id" of the unique id in database
knowledgeObj.node.id = element._id;
if (element.type == "projecttxt") {
knowledgeObj.rect(60, 40).attr({
fill: colours[Math.floor(Math.random() * colours.length)]
......@@ -93,37 +121,33 @@ export default {
fill: colours[Math.floor(Math.random() * colours.length)]
});
}
// loops through applying all the positions if id matches
// needs to be running this update in Realtime to update moves
// maybe in watch: { } ??? function ???
data2.forEach(element => {
// console.log(element.id)
// console.log(element.xpos)
// console.log(element.ypos)
console.log(knowledgeObj)
objectsProcessed++;
if (objectsProcessed === data.length) {
nodes.fire("startyourpositions");
console.log("fire...");
}
});
//console.log(knowledgeObj.node.id);
// parentNode
//console.log(knowledgeObj.node.id);
// parentNode
// Visualising whats in the couch
// var type = knowledgeObj.text(element.type);
// var title = knowledgeObj.text(element.title);
// var uniqueid = knowledgeObj.text(element._id);
// title.move(0, 40);
// uniqueid.move(0, 80);
// OLD Visualising whats in the couch
// var type = knowledgeObj.text(element.type);
// var title = knowledgeObj.text(element.title);
// var uniqueid = knowledgeObj.text(element._id);
// title.move(0, 40);
// uniqueid.move(0, 80);
// rect_1.connectable({
// container: links,
// markers: markers
// }, rect_2).setLineColor("#000000");
});
// rect_1.connectable({
// container: links,
// markers: markers
// }, rect_2).setLineColor("#000000");
// mousedown is capturing a single mouse press
// possibly useful for drawing connections between objects
nodes.mousedown(node => {
console.log("start connect");
//console.log("start connect");
});
nodes.mouseup(event => {
......@@ -138,7 +162,7 @@ export default {
this.$store.dispatch("updateKnowledgePosition", this);
// the node which was clicked
//console.log(event.target);
console.log(event.clientX);
//console.log(event.clientX);
// the svgjs object
//console.log(SVG.adopt(event.target))
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment