bratch9
March 31st, 2024, 12:49
NOTE. Suggested code change at bottom for this issue....
If you add the below code to 'CoreRPG\campaign\scripts\image.lua'
function onInit()
Debug.chat("image onInit",self);
end
function onClose()
Debug.chat("image onClose",self);
end
Open a new image, you will get this sort of sequence as you increase its size via the maximise BUTTON uasge.
-on initial window open.
s'image onInit' | imagecontrol = { name = s'image', x,y,w,h = 10,83,580,507 }
- on first maximise button usage to increase window size.
s'image onInit' | imagecontrol = { name = s'image', x,y,w,h = 0,0,0,0 }
s'image onClose' | imagecontrol = { name = s'image', x,y,w,h = 10,83,580,507 }
- on second maximise button to increase window size.
s'image onClose' | imagecontrol = { name = s'image', x,y,w,h = 1,45,1858,1104 }
s'image onInit' | imagecontrol = { name = s'image', x,y,w,h = 0,0,0,0 }
You will notice on the 'first' maximise you end up with 2 active windows before it closes the original window, but on the second maximise it correctly first closes the window and creates the new window.
The 'onClose/onInit' sequence is correct in each maximise button and minimise button usage, EXCEPT for going from a 'normal' window to the 'back panel'.
SOLUTION, in 'manager_image.lua'
function sendWindowToBackPanel(w)
local wBackPanel = ImageManager.getBackPanel();
if not wBackPanel then
return;
end
local sClass = w.getClass();
if (sClass or "") ~= "imagewindow" then
return;
end
local vNode = w.getDatabaseNode();
if not vNode then
return;
end
local x,y,zoom = w.image.getViewpoint();
ImageManager.setPanelValue(wBackPanel, DB.getPath(vNode), x, y, zoom);
w.close();
end
change the order of the w.close() at the end to above the setPanelValue, ie...
function sendWindowToBackPanel(w)
local wBackPanel = ImageManager.getBackPanel();
if not wBackPanel then
return;
end
local sClass = w.getClass();
if (sClass or "") ~= "imagewindow" then
return;
end
local vNode = w.getDatabaseNode();
if not vNode then
return;
end
local x,y,zoom = w.image.getViewpoint();
-- CLOSE old window, before OPEN new larger back panel
w.close();
ImageManager.setPanelValue(wBackPanel, DB.getPath(vNode), x, y, zoom);
end
All the other 'sendBackPanelToMaxPanel', 'sendMaxPanelToFullPanel', 'sendFullPanelToMaxPanel', 'sendMaxPanelToBackPanel', 'sendBackPanelToWindow' function as expected and 'close' the window first before creating the next size window.
The inconsistency of the 'sendWindowToBackPanel' doing the open new window then the close old window can cause window tracking issues.
-pete
If you add the below code to 'CoreRPG\campaign\scripts\image.lua'
function onInit()
Debug.chat("image onInit",self);
end
function onClose()
Debug.chat("image onClose",self);
end
Open a new image, you will get this sort of sequence as you increase its size via the maximise BUTTON uasge.
-on initial window open.
s'image onInit' | imagecontrol = { name = s'image', x,y,w,h = 10,83,580,507 }
- on first maximise button usage to increase window size.
s'image onInit' | imagecontrol = { name = s'image', x,y,w,h = 0,0,0,0 }
s'image onClose' | imagecontrol = { name = s'image', x,y,w,h = 10,83,580,507 }
- on second maximise button to increase window size.
s'image onClose' | imagecontrol = { name = s'image', x,y,w,h = 1,45,1858,1104 }
s'image onInit' | imagecontrol = { name = s'image', x,y,w,h = 0,0,0,0 }
You will notice on the 'first' maximise you end up with 2 active windows before it closes the original window, but on the second maximise it correctly first closes the window and creates the new window.
The 'onClose/onInit' sequence is correct in each maximise button and minimise button usage, EXCEPT for going from a 'normal' window to the 'back panel'.
SOLUTION, in 'manager_image.lua'
function sendWindowToBackPanel(w)
local wBackPanel = ImageManager.getBackPanel();
if not wBackPanel then
return;
end
local sClass = w.getClass();
if (sClass or "") ~= "imagewindow" then
return;
end
local vNode = w.getDatabaseNode();
if not vNode then
return;
end
local x,y,zoom = w.image.getViewpoint();
ImageManager.setPanelValue(wBackPanel, DB.getPath(vNode), x, y, zoom);
w.close();
end
change the order of the w.close() at the end to above the setPanelValue, ie...
function sendWindowToBackPanel(w)
local wBackPanel = ImageManager.getBackPanel();
if not wBackPanel then
return;
end
local sClass = w.getClass();
if (sClass or "") ~= "imagewindow" then
return;
end
local vNode = w.getDatabaseNode();
if not vNode then
return;
end
local x,y,zoom = w.image.getViewpoint();
-- CLOSE old window, before OPEN new larger back panel
w.close();
ImageManager.setPanelValue(wBackPanel, DB.getPath(vNode), x, y, zoom);
end
All the other 'sendBackPanelToMaxPanel', 'sendMaxPanelToFullPanel', 'sendFullPanelToMaxPanel', 'sendMaxPanelToBackPanel', 'sendBackPanelToWindow' function as expected and 'close' the window first before creating the next size window.
The inconsistency of the 'sendWindowToBackPanel' doing the open new window then the close old window can cause window tracking issues.
-pete