flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
294 stars 25 forks source link

Docking not working #115

Open megagrump opened 2 years ago

megagrump commented 2 years ago

I can't dock any window to any side of the screen in SlabTest. Dragging a window over one of the dock indicators does nothing. The indicator gets highlighted but nothing else happens.

Doing it programmatically like this:

if not docked then
    Slab.WindowToDock("bottom")
    docked = true
end

...makes the Window disappear, no matter if left, right or bottom.

flamendless commented 2 years ago

Hmm my commit for making dock work programmatically might have caused this issue. Will check soon

flamendless commented 2 years ago

Were you using WindowToDock with the SlabTest?

Dragging does not work for me now too. I wonder if this is due to the changes with the mouse api?

Have you checked this https://github.com/flamendless/Slab/wiki/Dock#windowtodock ? this works for me

megagrump commented 2 years ago

It's not caused by my changes. Every bug I report is double-checked against the released 0.9.0 code.

I tested WindowToDock in SlabTest. The window disappears.


    Slab.BeginWindow('SlabTest', SlabTest_Options)

    if not docked then
        Slab.WindowToDock('left')
        docked = true
    end
flamendless commented 2 years ago

I checked previous commits (before your changes) and yeah dragging wasn't working then. Weird that on a simple window it works but on SlabTest it does not 🤔 I'll have to do more digging

flamendless commented 2 years ago

@megagrump figured out the problem, you should be using Left/Right/Bottom (uppercase first character). I tested it on SlabTest and it works for me

image

Further testing shows the more of the following issues:

megagrump commented 2 years ago

Maybe there should be an error when using WindowToDock with an unknown value? Window just disappearing is confusing. It also gets saved with W and H being 0 in this case the non-existent location, meaning it stays hidden forever, even after a restart.

SlabTest crashes on quit for me now if the window was not docked:

Error: /Internal/UI/Dock.lua:350: table index is nil
megagrump commented 2 years ago
  1. Dock window programmatically
  2. Undock it with mouse
  3. Window can not be moved anymore
  4. table index is nil crash on exit
flamendless commented 2 years ago
  1. Dock window programmatically
  2. Undock it with mouse
  3. Window can not be moved anymore
  4. table index is nil crash on exit

I tried reproducing it using these steps. I didnt encounter number 3 as I can still freely move the window around. I get the error at number 4. Fixed.

flamendless commented 2 years ago

About this issue, I'll fix this as soon as your refactoring of the Window is done so there won't be conflicts if we work on the same file at the same time.

megagrump commented 2 years ago

Docking the main window to the right side of the screen does not look correct for me in SlabTest. Most of the window goes off the right side of the screen.

I still can't move the window after undocking.

Dock to the bottom, undock and quit the app. After restart: the window is in a weird position that makes it unusable. Only way to get out of this state is by deleting the saved ini file.

flamendless commented 2 years ago

Whats your whole test file?

megagrump commented 2 years ago

https://github.com/flamendless/Slab/blob/master/SlabTest.lua