Skip to content

Commit

Permalink
First improvement around collection manager, hide it when read only m…
Browse files Browse the repository at this point in the history
…ode navigation block is running and show it on edit mode, avoiding in this way errors imply dragging elements in locked mode
  • Loading branch information
cavearr committed Nov 16, 2024
1 parent 7349e4e commit deb54de
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
13 changes: 12 additions & 1 deletion app/resources/libs/Icestudio/GUI/Widgets/WafleUIWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,20 @@ class WafleUIWindow{
this.dom.style.right=params.right;
this.dom.style.width=params.width;
this.dom.style.height=params.height;
iceStudio.bus.events.subscribe(`Navigation::ReadOnly`,'hide',this);
iceStudio.bus.events.subscribe(`Navigation::ReadWrite`,'show',this);

}

hide(){
this.dom.style.display='none';
}

show(){
this.dom.style.display='block';
}

close(){
iceStudio.gui.removeDiv(`#${this.winId}`);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class WaflePluginExtEmbeddedWindowed extends WaflePlugin {
console.log('Plugin is running');
} else {

console.log('Windowed plugin ',this.uuid);
iceStudio.bus.events.subscribe(`${this.uuid}::Terminate`,'terminate',this,this.uuid);
this.running = true;
let _this = this;
Expand Down Expand Up @@ -95,11 +96,12 @@ class WaflePluginExtEmbeddedWindowed extends WaflePlugin {
}
}//--END run


terminate(){
iceStudio.gui.removeNode(this.dom.host);
this.dom.shadow=false;
this.dom.host=false;
this.running=false;
iceStudio.bus.events.removeById(this.uuid);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ class WaflePluginManager {
this.plugins[pluginId].run();
}
}
}
}
20 changes: 19 additions & 1 deletion app/scripts/controllers/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ angular
const last=common.submoduleHeap.length - 1;
common.submoduleId=common.submoduleHeap[last].id;
common.submoduleUID=common.submoduleHeap[last].uid;
iceStudio.bus.events.publish('Navigation::ReadOnly');
}else{
iceStudio.bus.events.publish('Navigation::ReadWrite');
}


loadSelectedGraph();
}
Expand All @@ -79,13 +83,16 @@ angular
const last=common.submoduleHeap.length - 1;
common.submoduleId=common.submoduleHeap[last].id;
common.submoduleUID=common.submoduleHeap[last].uid;
iceStudio.bus.events.publish('Navigation::ReadOnly');
}else{

iceStudio.bus.events.publish('Navigation::ReadWrite');
}
loadSelectedGraph();
}
};

$scope.editModeToggle = function ($event) {

var btn = $event.currentTarget;

if (!$scope.isNavigating) {
Expand All @@ -95,6 +102,7 @@ angular
var lockImg = false;
var lockImgSrc = false;
if (common.isEditingSubmodule) {

lockImg = $('img', btn);
lockImgSrc = lockImg.attr('data-lock');
lockImg[0].src = lockImgSrc;
Expand Down Expand Up @@ -138,8 +146,10 @@ angular
rw = false;
common.isEditingSubmodule = true;
subModuleActive = true;

}


$rootScope.$broadcast('navigateProject', {
update: false,
project: tmp,
Expand Down Expand Up @@ -238,6 +248,7 @@ angular
}
if (args.update) {
graph.resetView();

project.update({ deps: false }, function () {
graph.loadDesign(args.project.design, opt, function () {
utils.endBlockingTask();
Expand All @@ -262,6 +273,13 @@ angular
$scope.breadcrumbsBack();
}

if (common.isEditingSubmodule || common.submoduleHeap.length===0){
iceStudio.bus.events.publish('Navigation::ReadWrite');
}else{

iceStudio.bus.events.publish('Navigation::ReadOnly');
}

});

$rootScope.$on('breadcrumbsBack', function (/*event*/) {
Expand Down

0 comments on commit deb54de

Please sign in to comment.