scaling and positioning proportionally an object at the same time
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Wed Apr 18 09:47:47 EDT 2007
Bonjour Christian,
Le 18 avr. 07 à 15:18, Christian Langers a écrit :
> Hello,
>
> I try since hours to do this :
>
> I have an image (photo) on a stack which scales to the right and
> down on resizing the stack (via Geometry Manager); I have a graphic
> (rectangle) placed at a precise location on the image (the user
> selects a portion of the image to hilite something on it);
>
> Now I want that when the user resizes the window the graphic scales
> and moves (up/down) proportionaly to the image , so that the
> rectangle grows and shrinks with the image hiliting always the same
> portion of the image (e.g. an eye of a face); I hope you follow
> (it's difficult to explain this in English)...
>
> I tried to use the GM in REv, but ...brrr... the graphic jumps away
> from its original position when resizing...
> So... please ! Heeeelp... This is getting me on my nerves ;-)
> Thanks for any suggestions or solutions...
>
> Christian
> from Luxembourg
Actually don't trust the Geometry Manager and prefer to write your
own routines in a resizeStack handler ;-)
Here is, for instance, an excerpt from such a handler:
on resizeStack pNewW,pNewH,pOldW,pOldH -- note params passed by Rev ;-)
global gPrefs
-----
if gPrefs["uAdds"] then ProportionalWResize the long name of img
"ToolbarShadow",pNewW,114
else ProportionalWResize the long name of img "ToolbarShadow",pNewW,0
pass resizeStack
end resizeStack
And:
on ProportionalWResize pObj,pNewW,pDelta
local tRect
-----
put the rect of pObj into tRect
put pNewW - pDelta into item 3 of tRect
set the rect of pObj to tRect
end ProportionalWResize
Of course, the above example is simple and, sometimes, it might
appear more tricky...
But actually, Rev allows to script any complex resizing in any case ;-)
Good luck!
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
http://www.sosmartsoftware.com/
eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------
More information about the use-livecode
mailing list