-
February 5th, 2023, 20:16 #1
Panel resizing (imagebackpanel)... works now?
So back when I implemented BetterMenus (drop down menus) I couldn't ever get resizing of panels to work. Specifically imagebackpanel. Someone today mentioned that now the sidebar does this and I started poking around but didn't have the block of time to figure out what it was doing to make this work.
I'm wanting to remove my panel "merge" and then adjust the settings based on what the user selects (Menus or Sidebar) and when using a Menu make sure the imagepanel is full desktop and when they use Sidebar it's default for whatever sidebar uses.
I wasn't able to find where this was happening in the time I had and am hoping JPG (or someone else) can point me where this resizing is actually happening so I can tweak 2E to correct for it.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
February 6th, 2023, 16:03 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
Both of the panels you are asking about (shortcuts, imagebackpanel) are anchored to a separate shortcutsanchor panel with zero width. The DesktopManager script sets the anchors on the shortcutsanchor panel to which both the shortcuts and imagebackpanel panels are anchored to.
Regards,
JPG
-
February 9th, 2023, 22:50 #3
So I played with this over a couple days to try and figure out how to make it work as I was needing and was unable too get it there. I think it presumes that the sidebar will ALWAYS be visible. I tried to set the visible to false, tried setting the width to 0 and various other methods but was unable to get it to where it would be usable for both styles of menus (all while I had disabled my panel and template overrides).
Can you give me anymore hints on this? The visibility variable gave me a lot of headache as I expected if I set that to false it wouldn't show it at all. I'm not actually sure it's used?---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
February 10th, 2023, 00:44 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
To be honest, it's not really something I have time to unwind at this point to figure out how to do this, as I'm neck deep in several projects and this is not part of the features we are working on updating.
The DesktopManager is designed to resize the sidebar based on the visibility button (narrow, 2-column, full); not to hide it. It does presume that the sidebar will always be visible, because for all of our use cases it is. I don't know why that would matter necessarily, because the position of the shortcuts anchor is set by
You could possibly overriding getSidebarDockWidth and getSidebarDockWithOffset and updateSidebarAnchorWindowPosition, so that the previous two functions return zero, and the final function to use different APIs to set the size. The current API in the latter function is setPosition with a negative offset which will only work if non-zero.
Regards,
JPG
-
February 10th, 2023, 15:58 #5
Trying what you suggested but I've ran into something that is probably a bug.
in manager_desktop.lua in CoreRPG
Code:local _nSidebarVisibility = true;
Code:function getSidebarDockWidth() if _nSidebarVisibility <= 0 then local nDockCategoryWidth = _szDockCategory.w + (_rcDockCategoryOffset.left + _rcDockCategoryOffset.right); local nDockButtonWidth = _szDockButton.w + (_rcDockButtonOffset.left + _rcDockButtonOffset.right); return math.max(nDockCategoryWidth, nDockButtonWidth); end local nDockIconWidth = DesktopManager.getSidebarDockIconWidth(); if _nSidebarVisibility == 1 then return nDockIconWidth * 2; end return nDockIconWidth; end
Fixing it locally corrects the error I'm seeing with it but I get other cascading errors from nil anchors/etcs when I try to make it do what the user request wanted. I've got quite a bit of work from day job as well so I'll let this one stew for a while. I don't have the time to add debug code to all of the desktop_manager ;(Last edited by celestian; February 10th, 2023 at 16:09.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
February 10th, 2023, 17:31 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
That variable gets set when the following chain is called in DesktopManager: onTabletopInit->initializeSidebar->loadSidebarState.
So, the initial value doesn't matter, since it is always set to a number (default zero).
If you're going to override those, you still need to make sure that the expected default behaviors are still running.
Regards,
JPG
-
February 10th, 2023, 21:28 #7
Pinged SuperTeddy and he had a great suggestion that ended up working. Thank you Teddy!
However, that _nSidebarVisibility I mentioned as bug is still and issue. I can fix it locally by overriding the entire desktop_manager.lua but would be great if it could be corrected. No where is it referenced as a boolean that I could tell. Setting it to one locally for me fixed it. Unless other rulesets depend on it being a boolean at some wierd state?
This is the code I ended up overriding to get what I wanted.
Code:function getSidebarDockWidth_adnd() -- override piece local bMenuStyle = (OptionsManager.getOption("OPTIONS_MENU") == 'menus' or OptionsManager.getOption("OPTIONS_MENU") == ''); -- need these local _nSidebarVisibility = DesktopManager.getSidebarVisibilityState(); local _szDockCategory = DesktopManager.getSidebarDockCategorySize(); local _rcDockCategoryOffset = DesktopManager.getSidebarDockCategoryOffset(); local _rcDockButtonOffset = DesktopManager.getSidebarDockButtonOffset(); local _szDockButton = DesktopManager.getSidebarDockButtonSize(); if (bMenuStyle) then _nSidebarVisibility = 4; end -- end override piece if _nSidebarVisibility <= 0 then local nDockCategoryWidth = _szDockCategory.w + (_rcDockCategoryOffset.left + _rcDockCategoryOffset.right); local nDockButtonWidth = _szDockButton.w + (_rcDockButtonOffset.left + _rcDockButtonOffset.right); return math.max(nDockCategoryWidth, nDockButtonWidth); end local nDockIconWidth = DesktopManager.getSidebarDockIconWidth(); if _nSidebarVisibility == 1 then return nDockIconWidth * 2; end -- override piece if (_nSidebarVisibility == 4) then nDockIconWidth = 0; end -- end override piece return nDockIconWidth; end
Last edited by celestian; February 10th, 2023 at 21:59.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
February 11th, 2023, 01:11 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
Looking at the 2E code, it's because you bypass the standard initialization of DesktopManager by overriding the initialization function in your own global MenuManager script. Because you are overriding the code, the initialization of all the variables normally done in DesktopManager.loadSidebarState is not being completed. This step should still be performed, even if you bypass the other parts of the initialization. Doing this will also preserve the visibility state of the sidebar when toggling between the two menu modes.
Regards,
JPG
-
February 11th, 2023, 02:17 #9
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
Just to help avoid this scenario, I've moved DesktopManager.loadSidebarState out of DesktopManager.initializeSidebar; and set the uninitialized variable to a safe value. This code is available in Test channel now.
Regards,
JPG
-
February 11th, 2023, 07:14 #10
I implemented these suggestions tonight and with a few other tweaks I was able to get to this state, which is pretty good. The only issue is when the desktop is resized the Menus buttons popout from hiding (I set them off screen with setPosition()). Is there a way to detect when the desktop is resized? If so I can probably use that to reset the panels "hidden" setPosition().
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks