Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Internal/UI/Dock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ local function DrawOverlay(Type)
return
end

-- Check DisableDocks for the window being dragged
if PendingWindow and PendingWindow.DisableDocks then
for _, d in ipairs(PendingWindow.DisableDocks) do
if d == Type then
return
end
end
end

local X, Y, W, H = GetOverlayBounds(Type)
local Color = {0.29, 0.59, 0.83, 0.65}
local TitleH = 14
Expand Down Expand Up @@ -183,14 +192,14 @@ function Dock.GetBounds(Type, Options)
W = Options.W or 150
H = ViewH - Y - TitleH
elseif Type == 'Right' then
X = ViewW - 150
Y = MainMenuBarH
W = Options.W or 150
X = ViewW - W
Y = MainMenuBarH
H = ViewH - Y - TitleH
elseif Type == 'Bottom' then
Y = ViewH - 150
W = ViewW
H = Options.H or 150
Y = ViewH - H
W = ViewW
end

return X, Y, W, H
Expand Down Expand Up @@ -364,4 +373,3 @@ function Dock.Load(Table)
end

return Dock

32 changes: 27 additions & 5 deletions Internal/UI/Window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,18 @@ function Window.Begin(id, options)

options = options or EMPTY

if not Mouse.IsDragging(1) then
local instance = GetInstance(id)
local dockType = Dock.GetDock(id)

if not Mouse.IsDragging(1) or dockType then
Dock.AlterOptions(id, options)
if dockType then
if instance.SizerType == 0 then
instance.TitleDeltaX = 0
instance.TitleDeltaY = 0
end
options.ResetPosition = false
end
end

local x = options.X or 50
Expand Down Expand Up @@ -578,7 +588,7 @@ function Window.Begin(id, options)
bodyRounding = rounding
end

local instance = GetInstance(id)
--local instance = GetInstance(id)
insert(PendingStack, 1, instance)

if options.IsMenuBar then
Expand All @@ -590,6 +600,10 @@ function Window.Begin(id, options)
end

ActiveInstance = instance
-- Save DisableDocks in the instance to access from Dock
if options.DisableDocks then
instance.DisableDocks = options.DisableDocks
end
if autoSizeWindowW then
w = 0
end
Expand All @@ -610,11 +624,19 @@ function Window.Begin(id, options)
if ActiveInstance.Border ~= border then
resetSize = true
end

ActiveInstance.X = ActiveInstance.TitleDeltaX + x
ActiveInstance.Y = ActiveInstance.TitleDeltaY + y
ActiveInstance.W = max(ActiveInstance.SizeDeltaX + w + border, border)
ActiveInstance.H = max(ActiveInstance.SizeDeltaY + h + border, border)
ActiveInstance.X = ActiveInstance.TitleDeltaX + x
ActiveInstance.Y = ActiveInstance.TitleDeltaY + y


-- Hard-fix position for docked windows
if dockType == 'Right' then
ActiveInstance.X = Scale.GetScreenWidth() - ActiveInstance.W
elseif dockType == 'Bottom' then
ActiveInstance.Y = Scale.GetScreenHeight() - ActiveInstance.H
end

ActiveInstance.ContentW = contentW
ActiveInstance.ContentH = contentH
ActiveInstance.BackgroundColor = bgColor
Expand Down