shifty squares
This commit is contained in:
parent
df717cb9b0
commit
3ff50d22d5
1 changed files with 42 additions and 2 deletions
40
pixler.bas
40
pixler.bas
|
|
@ -605,9 +605,29 @@ end sub
|
||||||
sub do.box (sx as long,sy as long,ex as long,ey as long,col as long)
|
sub do.box (sx as long,sy as long,ex as long,ey as long,col as long)
|
||||||
dim osource as long
|
dim osource as long
|
||||||
dim odest as long
|
dim odest as long
|
||||||
|
|
||||||
if state.isdrawing then
|
if state.isdrawing then
|
||||||
osource=_source
|
osource=_source
|
||||||
odest=_dest
|
odest=_dest
|
||||||
|
|
||||||
|
' --- Shift Held: Perfect Square Constraint ---
|
||||||
|
if _keydown(100303) or _keydown(100304) then
|
||||||
|
dim dx as long: dx = ex - sx
|
||||||
|
dim dy as long: dy = ey - sy
|
||||||
|
|
||||||
|
' Determine the longest side to use as the square dimensions
|
||||||
|
dim size as long
|
||||||
|
if abs(dx) > abs(dy) then size = abs(dx) else size = abs(dy)
|
||||||
|
|
||||||
|
' Shift coordinates relative to the direction of the drag
|
||||||
|
dim signx as long: if dx >= 0 then signx = 1 else signx = -1
|
||||||
|
dim signy as long: if dy >= 0 then signy = 1 else signy = -1
|
||||||
|
|
||||||
|
ex = sx + (size * signx)
|
||||||
|
ey = sy + (size * signy)
|
||||||
|
end if
|
||||||
|
' ---------------------------------------------
|
||||||
|
|
||||||
if mouseclicked or rmouseclicked then
|
if mouseclicked or rmouseclicked then
|
||||||
_dest layers(1).ihandle
|
_dest layers(1).ihandle
|
||||||
addcommand"box ("+tst(sx)+","+tst(sy)+","+tst(ex)+","+tst(ey)+","+hex$(col)+")"
|
addcommand"box ("+tst(sx)+","+tst(sy)+","+tst(ex)+","+tst(ey)+","+hex$(col)+")"
|
||||||
|
|
@ -624,9 +644,29 @@ end sub
|
||||||
sub do.fbox (sx as long,sy as long,ex as long,ey as long,col as long)
|
sub do.fbox (sx as long,sy as long,ex as long,ey as long,col as long)
|
||||||
dim osource as long
|
dim osource as long
|
||||||
dim odest as long
|
dim odest as long
|
||||||
|
|
||||||
if state.isdrawing then
|
if state.isdrawing then
|
||||||
osource=_source
|
osource=_source
|
||||||
odest=_dest
|
odest=_dest
|
||||||
|
|
||||||
|
' --- Shift Held: Perfect Square Constraint ---
|
||||||
|
if _keydown(100303) or _keydown(100304) then
|
||||||
|
dim dx as long: dx = ex - sx
|
||||||
|
dim dy as long: dy = ey - sy
|
||||||
|
|
||||||
|
' Determine the longest side to use as the square dimensions
|
||||||
|
dim size as long
|
||||||
|
if abs(dx) > abs(dy) then size = abs(dx) else size = abs(dy)
|
||||||
|
|
||||||
|
' Shift coordinates relative to the direction of the drag
|
||||||
|
dim signx as long: if dx >= 0 then signx = 1 else signx = -1
|
||||||
|
dim signy as long: if dy >= 0 then signy = 1 else signy = -1
|
||||||
|
|
||||||
|
ex = sx + (size * signx)
|
||||||
|
ey = sy + (size * signy)
|
||||||
|
end if
|
||||||
|
' ---------------------------------------------
|
||||||
|
|
||||||
if mouseclicked or rmouseclicked then
|
if mouseclicked or rmouseclicked then
|
||||||
_dest layers(1).ihandle
|
_dest layers(1).ihandle
|
||||||
addcommand"fbox ("+tst(sx)+","+tst(sy)+","+tst(ex)+","+tst(ey)+","+hex$(col)+")"
|
addcommand"fbox ("+tst(sx)+","+tst(sy)+","+tst(ex)+","+tst(ey)+","+hex$(col)+")"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue