Skip to content

Commit

Permalink
Improve route algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
cavearr committed Nov 10, 2024
1 parent 5a01a34 commit 4b7f31d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/scripts/services/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ angular.module('icestudio')
between modules, we fix with the new engine , meanwhile this works --*/
let _this=this;
$('body').on('Graph::updateWires',function(){
setTimeout(function(){
//setTimeout(function(){
_this.updateWires();
},750);
//},1200);
});

//-- ZOOM constants
Expand Down Expand Up @@ -467,8 +467,9 @@ angular.module('icestudio')
self.addingDraggableBlock = false;
processReplaceBlock(selection.at(0));
disableSelected();
updateWiresOnObstacles();
updateWiresOnObstacles().then(() => {
graph.trigger('batch:stop');
});
}
else {
// Toggle selected cell
Expand Down Expand Up @@ -870,7 +871,7 @@ angular.module('icestudio')
updateWiresOnObstacles();
};

function updateWiresOnObstacles() {
function __updateWiresOnObstacles() {
let cells = graph.getCells();

//_.each(cells, function (cell) {
Expand All @@ -880,6 +881,14 @@ angular.module('icestudio')
}
}
}
function updateWiresOnObstacles() {
return new Promise(resolve => {
setTimeout(() => {
__updateWiresOnObstacles();
resolve(); // Resuelve la promesa después de ejecutar la función
}, 1000); // Espera de 1 segundo
});
}

this.setBoardRules = function (rules) {
let cells = graph.getCells();
Expand Down

0 comments on commit 4b7f31d

Please sign in to comment.