fix floodfill redraw, added eyedropper tool back in.

This commit is contained in:
visionmercer 2026-05-20 09:06:25 +02:00
commit a0b0bbc939
3 changed files with 34 additions and 8 deletions

View file

@ -90,8 +90,6 @@ do
if showcolorpicker then colorpicker
if showcommands then commandlist
'Mouse Handling
while _mouseinput:mw=mw+_mousewheel:wend
mouseclicked = 0
@ -198,6 +196,7 @@ sub redraw
for i=lbound(commands) to ubound(commands)
getnums commands(i),numarr()
_dest layers(1).ihandle
_source layers(1).ihandle
select case lcase$(_trim$(left$(commands(i),instr(commands(i),"(")-1)))
case "canvas"
for j=0 to 3
@ -704,18 +703,31 @@ sub do.floodfill(x as long,y as long, col as long)
_dest layers(1).ihandle
FloodFill x,y,col
addcommand "floodfill ("+tst(x)+","+tst(y)+","+hex$(col)+")"
state.isDrawing = 0
_source osource
_dest odest
end if
end sub
sub do.eyedropper(x,y)
sub do.eyedropper(x as long, y as long)
dim osource as long
dim odest as long
osource = _source
odest = _dest
_source layers(1).ihandle
if _mousebutton(1) or _mousebutton(2) then
osource = _source
_source layers(1).ihandle ' Read from the main drawing layer
' Ensure the coordinates are within the canvas boundaries
if x >= 0 and x < _width(layers(1).ihandle) and y >= 0 and y < _height(layers(1).ihandle) then
' Left click sets foreground color, Right click sets background color
if _mousebutton(1) then
state.fcolor = pickedColor
addcommand "fcolor (" + hex$(point(x, y)) + ")"
elseif _mousebutton(2) then
state.bcolor = pickedColor
addcommand "bcolor (" + hex$(point(x, y)) + ")"
end if
end if
state.isDrawing = 0
_source osource
end if
end sub
function icon (index as long)