[REBOL] Re: View/VID: interactive face or image resizing
From: greggirwin:mindspring at: 12-Nov-2002 13:59
Hi Jose,
j> Does anybody know how to dynamically resize an image
j> or face by dragging the edges of the image or the
j> corner ?
If you look at the event to see if the mouse is near an edge, then you
can just alter the /size of the face, rather than the /offset. In some
old code I have, I stored event/offset in face/data when the mouse was
pressed and then did the following as part of face/engage:
if find [over away] act [
either any [(face/data/x < (face/size/x - 15)) (face/data/y < (face/size/y - 15))] [
face/offset: face/offset + event/offset - face/data
][
face/size: face/size + (event/offset - face/data)
; Impose size constraints
if (face/size/x < 100) [face/size/x: 100]
if (face/size/y < 40) [face/size/y: 40]
if (face/size/x > 400) [face/size/x: 400]
if (face/size/y > 100) [face/size/y: 100]
face/data: face/data + (event/offset - face/data)
]
show face
]
-- Gregg