mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add core:toggle-navigator action
This commit is contained in:
parent
7a01b115bb
commit
f6c017176b
@ -65,13 +65,28 @@
|
|||||||
.attr('height',chartSize[1]/nav_scale/scaleFactor)
|
.attr('height',chartSize[1]/nav_scale/scaleFactor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function toggle() {
|
||||||
|
if (!isShowing) {
|
||||||
|
isShowing = true;
|
||||||
|
$("#btn-navigate").addClass("selected");
|
||||||
|
resizeNavBorder();
|
||||||
|
refreshNodes();
|
||||||
|
$("#chart").on("scroll",onScroll);
|
||||||
|
navContainer.fadeIn(200);
|
||||||
|
} else {
|
||||||
|
isShowing = false;
|
||||||
|
navContainer.fadeOut(100);
|
||||||
|
$("#chart").off("scroll",onScroll);
|
||||||
|
$("#btn-navigate").removeClass("selected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: function() {
|
init: function() {
|
||||||
|
|
||||||
$(window).resize(resizeNavBorder);
|
$(window).resize(resizeNavBorder);
|
||||||
RED.events.on("sidebar:resize",resizeNavBorder);
|
RED.events.on("sidebar:resize",resizeNavBorder);
|
||||||
|
RED.actions.add("core:toggle-navigator",toggle);
|
||||||
var hideTimeout;
|
var hideTimeout;
|
||||||
|
|
||||||
navContainer = $('<div>').css({
|
navContainer = $('<div>').css({
|
||||||
@ -141,23 +156,12 @@
|
|||||||
|
|
||||||
$("#btn-navigate").click(function(evt) {
|
$("#btn-navigate").click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if (!isShowing) {
|
toggle();
|
||||||
isShowing = true;
|
|
||||||
$("#btn-navigate").addClass("selected");
|
|
||||||
resizeNavBorder();
|
|
||||||
refreshNodes();
|
|
||||||
$("#chart").on("scroll",onScroll);
|
|
||||||
navContainer.fadeIn(200);
|
|
||||||
} else {
|
|
||||||
isShowing = false;
|
|
||||||
navContainer.fadeOut(100);
|
|
||||||
$("#chart").off("scroll",onScroll);
|
|
||||||
$("#btn-navigate").removeClass("selected");
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refresh: refreshNodes,
|
refresh: refreshNodes,
|
||||||
resize: resizeNavBorder
|
resize: resizeNavBorder,
|
||||||
|
toggle: toggle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user