diff --git a/app/js/app-menu.js b/app/js/app-menu.js index 35e4ffae..115c7f42 100644 --- a/app/js/app-menu.js +++ b/app/js/app-menu.js @@ -1486,16 +1486,14 @@ module.exports = function() { var chiseInstance = appUtilities.getActiveChiseInstance(); // if there is no element in the cy instance, then return directly + var cy = chiseInstance.getCy(); if(cy.elements().length == 0) { return; } console.log("layout-spinner") chiseInstance.startSpinner("layout-spinner") - // use the associated cy instance setTimeout(() => { - var cy = chiseInstance.getCy(); - // get current general properties for cy var currentGeneralProperties = appUtilities.getScratch(cy, 'currentGeneralProperties'); var preferences = { @@ -1510,22 +1508,16 @@ module.exports = function() { // use active chise instance var chiseInstance = appUtilities.getActiveChiseInstance(); - // TODO think whether here is the right place to start the spinner - chiseInstance.startSpinner("layout-spinner"); - - // use the associated cy instance - setTimeout(() => { - var cy = chiseInstance.getCy(); - // if there is no element in the cy instance, then return directly + var cy = chiseInstance.getCy(); if(cy.elements().length == 0) { return; } + chiseInstance.startSpinner("layout-spinner"); + + setTimeout(() => { // get current general properties for cy var currentGeneralProperties = appUtilities.getScratch(cy, 'currentGeneralProperties'); - - - var preferences = { quality: (cy.nodes().length > 3000 || cy.edges().length > 3000) ? "draft" : "default", animate: (cy.nodes().length > 3000 || cy.edges().length > 3000) ? false : currentGeneralProperties.animateOnDrawingChanges, diff --git a/app/js/backbone-views.js b/app/js/backbone-views.js index 3359425c..4b0e9d3c 100644 --- a/app/js/backbone-views.js +++ b/app/js/backbone-views.js @@ -4354,8 +4354,13 @@ var PromptConfirmationView = Backbone.View.extend({ $(document) .off("click", "#prompt-confirmation-accept") .on("click", "#prompt-confirmation-accept", function (evt) { - afterFunction(); $(self.el).modal("toggle"); + + // This timeout is to insure that the modal disappers properly. + // Without this sometimes there would be weird behavior on file loading. + setTimeout(() => { + afterFunction(); + }, 500); }); $(document)