diff options
| author | 1029chris <1029chris@gmail.com> | 2016-04-12 12:21:36 -0700 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2016-04-12 12:21:36 -0700 |
| commit | 1b6abae83cf3c9f31f25f63d3dba75af69728962 (patch) | |
| tree | 12300255bbad0f207dc42f4d0b4b8bdd47708683 /window.lua | |
| parent | 078d3076a138f379e56d555c4927623eeee7b5f1 (diff) | |
Made it so Windows cannot leave the screen
They are restricted to stay in view
Diffstat (limited to 'window.lua')
| -rw-r--r-- | window.lua | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -82,8 +82,20 @@ function drawWindow(id) win[id].py = win[id].y end if sys.mouse.drag == true and win[id].min == false and win[id].ex == false and layer[1] == id then - win[id].x = win[id].px + (sys.mouse.x - sys.mouse.p.x) - win[id].y = win[id].py + (sys.mouse.y - sys.mouse.p.y) + if win[id].px+(sys.mouse.x - sys.mouse.p.x) >= 0 and win[id].px+(sys.mouse.x - sys.mouse.p.x) <= sys.w-win[id].w then + win[id].x = win[id].px + (sys.mouse.x - sys.mouse.p.x) + elseif win[id].px+(sys.mouse.x - sys.mouse.p.x) < 0 then + win[id].x = 0 + elseif win[id].px+(sys.mouse.x - sys.mouse.p.x) > sys.w-win[id].w then + win[id].x = sys.w-win[id].w + end + if win[id].py+(sys.mouse.y - sys.mouse.p.y) >= 0 and win[id].py+(sys.mouse.y - sys.mouse.p.y) <= sys.h-win[id].h-panel.thick-1 then + win[id].y = win[id].py + (sys.mouse.y - sys.mouse.p.y) + elseif win[id].py+(sys.mouse.y - sys.mouse.p.y) < 0 then + win[id].y = 0 + elseif win[id].py+(sys.mouse.y - sys.mouse.p.y) > sys.h-win[id].h-panel.thick-1 then + win[id].y = sys.h-win[id].h-panel.thick-1 + end end if (sys.mouse.p.p == true and sys.mouse.p.x >= win[id].x+win[id].w-22 and sys.mouse.p.x <= (win[id].x+win[id].w-22)+16 and win[id].ex == false and sys.mouse.drag == false and sys.mouse.p.y >= win[id].y+5 and sys.mouse.p.y <= (win[id].y+5)+16 and win[id].hover == true) and v1.yes == false then |
