Added changing name of diagram
This commit is contained in:
parent
69547f6114
commit
a96d786e23
@ -4,6 +4,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<a href="#" id="projectName">New Diagram</a>
|
||||
<a href="#" id="import">Open File</a>
|
||||
<a href="#" id="export">Save</a>
|
||||
<input type="file" id="importUpload"></input>
|
||||
|
@ -1,4 +1,6 @@
|
||||
var $ = require("jquery");
|
||||
var events = require("./events.js");
|
||||
var diagram = require("./diagram");
|
||||
|
||||
$("#header>a#export").click(function(){
|
||||
var fileSaver = require("file-saver");
|
||||
@ -17,5 +19,16 @@ $("#header>#importUpload").change(function(){
|
||||
require("./diagram/import.js")(reader.result);
|
||||
}
|
||||
reader.readAsText(this.files[0]);
|
||||
//console.log($("#header>#importUpload")[0].files[0])
|
||||
})
|
||||
});
|
||||
|
||||
$("#header>a#projectName").click(function(){
|
||||
do{
|
||||
diagram.name = prompt("Please enter a name for the diagram", diagram.name);
|
||||
}
|
||||
while(!diagram.name);
|
||||
$("#header>a#projectName").html(diagram.name);
|
||||
});
|
||||
|
||||
events.subscribe("diagramImport", function(){
|
||||
$("#header>a#projectName").html(diagram.name);
|
||||
});
|
||||
|
@ -15,8 +15,8 @@ function resolveOutput(block, cache){
|
||||
}
|
||||
|
||||
var output = "";
|
||||
if(Object.keys(blocks[block.type].inputs).length == Object.keys(inputValues).length){
|
||||
var output = blocks[block.type].execute(inputValues, block);
|
||||
if(Object.keys(blocks[block.type].inputs).length == Object.keys(inputValues).length){ //only execute if all inputs are present
|
||||
output = blocks[block.type].execute(inputValues, block);
|
||||
}
|
||||
cache[block.id] = output;
|
||||
|
||||
|
@ -4,7 +4,7 @@ var events = require("../events.js");
|
||||
var $ = require("jquery");
|
||||
|
||||
function moveLine(elem, a, b, c, d){
|
||||
[[a, b], [c, d]] = [[a, b], [c, d]].sort((a, b)=>(a[0] > b[0])); //swap coords based on x-value, a will always be smaller than b
|
||||
[[a, b], [c, d]] = [[a, b], [c, d]].sort((a, b)=>(a[0] - b[0])); //swap coords based on x-value, a will always be smaller than b
|
||||
var l = Math.sqrt(Math.pow(a - c, 2) + Math.pow(d - b, 2));
|
||||
var x = (a + c - l) / 2;
|
||||
var y = (b + d) / 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user