load/save viewport settings

For additional smarts I save this per file. (It won't go in Filename to
let different people be looking in different areas.)
This commit is contained in:
Kartik K. Agaram 2023-04-20 20:18:15 -07:00
parent 521d7825c3
commit 4d3382360a
4 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,9 @@ on.initialize = function(arg)
if #arg > 0 then
Filename = arg[1]
end
if Settings[Filename] then
Viewport = Settings[Filename].viewport
end
if file_exists(Filename) then
load_graph_from_disk()
end

4
0065-on.load_settings Normal file
View File

@ -0,0 +1,4 @@
on.load_settings = function(settings)
Settings = settings
-- we don't know the Filename yet, so do nothing else
end

5
0066-on.save_settings Normal file
View File

@ -0,0 +1,5 @@
on.save_settings = function()
-- save viewport by filename
Settings[Filename] = {viewport=Viewport}
return Settings
end

1
0067-Settings Normal file
View File

@ -0,0 +1 @@
Settings = {}