1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Restore scroll position on tab switch

This commit is contained in:
Nicholas O'Leary 2013-10-27 21:05:12 +00:00
parent 386520e65b
commit c9344cd5f1

View File

@ -24,6 +24,7 @@ RED.view = function() {
node_height = 30; node_height = 30;
var activeWorkspace = 0; var activeWorkspace = 0;
var workspaceScrollPositions = {};
var selected_link = null, var selected_link = null,
mousedown_link = null, mousedown_link = null,
@ -1088,7 +1089,18 @@ RED.view = function() {
return activeWorkspace; return activeWorkspace;
}, },
setWorkspace: function(z) { setWorkspace: function(z) {
var chart = $("#chart");
if (activeWorkspace != 0) {
workspaceScrollPositions[activeWorkspace] = {
left:chart.scrollLeft(),
top:chart.scrollTop()
};
}
activeWorkspace = z; activeWorkspace = z;
if (workspaceScrollPositions[activeWorkspace]) {
chart.scrollLeft(workspaceScrollPositions[activeWorkspace].left);
chart.scrollTop(workspaceScrollPositions[activeWorkspace].top);
}
clearSelection(); clearSelection();
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
n.dirty = true; n.dirty = true;