Better toolbox handling.

This commit is contained in:
visionmercer 2026-05-04 12:30:34 +02:00
commit b5cac2ac8d

View file

@ -70,7 +70,6 @@ do
oldHeight = _height
end if
cls
line (0,0)-(_width-1,_height-1),backgroundcolor1,bf
'Mouse Handling
@ -182,6 +181,7 @@ sub colorpicker
end sub
sub canvas
' 1. Define the Viewport (The "Window" on your screen)
dim viewX1 as integer
if showtoolbox then viewX1 = 70 else viewX1 = 0
@ -236,7 +236,19 @@ sub canvas
_putimage (drawX1, drawY1)-(drawX2, drawY2), img, 0, (srcX1, srcY1)-(srcX2, srcY2)
end if
next
' 2.5 if the mouse is in ui thats all we need
if showtoolbox then
if _mousex >= 0 and _mousex <= 70 then
exit sub
end if
end if
if showcolorpicker then
if _mousey >= _height - 20 then
exit sub
end if
end if
' 3. Calculate Canvas Coordinates
dim canX as integer: canX = int((_mousex - state.offsetX) / state.zoom)
dim canY as integer: canY = int((_mousey - state.offsetY) / state.zoom)