Skip to content

Commit

Permalink
FIX: update ID when uploading SM
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentetsu committed Nov 5, 2020
1 parent cffcfad commit 995172f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/js/script_method.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,4 +630,22 @@ function handleFileLoad(event) {
});

document.getElementById("file-selector").value = "";

updateID();
}

function updateID() {
var _sid = 0;
var _tid = 0;

canvas.forEachObject(function(obj) {
if(obj.n_type === "state" && obj.id > _sid) {
_sid = obj.id;
} else if(obj.n_type === "transition" && obj.id > _tid) {
_tid = obj.id;
}
});

ID_state = _sid + 1;
ID_transition = _tid + 1;
}

0 comments on commit 995172f

Please sign in to comment.