Skip to content

Commit

Permalink
[Window]
Browse files Browse the repository at this point in the history
Adjust region size to fit within the window. This will show the scrollbar if the window extends beyond the display.

close flamendless#49
  • Loading branch information
coding-jackalope committed Oct 10, 2020
1 parent a4890a9 commit afda783
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Internal/UI/Window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,17 @@ function Window.Begin(Id, Options)
Region.End()
end

local RegionW = ActiveInstance.W
local RegionH = ActiveInstance.H

if ActiveInstance.X + ActiveInstance.W > love.graphics.getWidth() then RegionW = love.graphics.getWidth() - ActiveInstance.X end
if ActiveInstance.Y + ActiveInstance.H > love.graphics.getHeight() then RegionH = love.graphics.getHeight() - ActiveInstance.Y end

Region.Begin(ActiveInstance.Id, {
X = ActiveInstance.X,
Y = ActiveInstance.Y,
W = ActiveInstance.W,
H = ActiveInstance.H,
W = RegionW,
H = RegionH,
ContentW = ActiveInstance.ContentW + ActiveInstance.Border,
ContentH = ActiveInstance.ContentH + ActiveInstance.Border,
BgColor = ActiveInstance.BackgroundColor,
Expand Down

0 comments on commit afda783

Please sign in to comment.