shifty straight lines.
This commit is contained in:
parent
bbdb7a3033
commit
4e2d0dd9b1
1 changed files with 26 additions and 2 deletions
24
pixler.bas
24
pixler.bas
|
|
@ -487,9 +487,32 @@ end sub
|
|||
sub do.line(sx as long,sy as long,ex as long,ey as long,col as long)
|
||||
dim osource as long
|
||||
dim odest as long
|
||||
|
||||
if state.isdrawing then
|
||||
osource=_source
|
||||
odest=_dest
|
||||
|
||||
' --- 45-Degree Angle Snapping Logic ---
|
||||
if _keydown(100303) or _keydown(100304) then
|
||||
dim dx as single:dx=ex-sx
|
||||
dim dy as single:dy=ey-sy
|
||||
|
||||
if dx<>0 or dy<>0 then
|
||||
dim linelen as single:linelen=sqr(dx*dx+dy*dy)
|
||||
dim angle as single:angle=_atan2(dy,dx)
|
||||
|
||||
dim pi as single:pi=3.14159265
|
||||
dim degrees as single:degrees=angle*(180.0/pi)
|
||||
dim snappeddegrees as single:snappeddegrees=int((degrees+22.5)/45.0)*45.0
|
||||
dim snappedangle as single:snappedangle=snappeddegrees*(pi/180.0)
|
||||
|
||||
' FIX: Changed int() to _round() to prevent left/top pixel drifting
|
||||
ex=sx+_round(linelen*cos(snappedangle))
|
||||
ey=sy+_round(linelen*sin(snappedangle))
|
||||
end if
|
||||
end if
|
||||
' --------------------------------------
|
||||
|
||||
if mouseclicked or rmouseclicked then
|
||||
_dest layers(1).ihandle
|
||||
addcommand"line ("+tst(sx)+","+tst(sy)+","+tst(ex)+","+tst(ey)+","+hex$(col)+")"
|
||||
|
|
@ -497,6 +520,7 @@ sub do.line(sx as long,sy as long,ex as long,ey as long,col as long)
|
|||
else
|
||||
_dest layers(2).ihandle
|
||||
end if
|
||||
|
||||
thickline sx,sy,ex,ey,col
|
||||
_source osource
|
||||
_dest odest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue