From 995172f7480a9a4f31eae3fe98c21e02b486c356 Mon Sep 17 00:00:00 2001 From: Zentetsu <10742751+Zentetsu@users.noreply.github.com> Date: Thu, 5 Nov 2020 18:41:45 +0100 Subject: [PATCH] FIX: update ID when uploading SM --- docs/js/script_method.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/js/script_method.js b/docs/js/script_method.js index e443184..1587911 100644 --- a/docs/js/script_method.js +++ b/docs/js/script_method.js @@ -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; } \ No newline at end of file