Page 1 of 2

Object resize when dragged into another object

Posted: Fri Aug 17, 2012 10:19 am
by Surbhit29
I have an object Rectangle and another rectangle smaller than previous one. What I want is when I drag the larger Rectangle on smaller rectangle the larger rectangle changes it size into the smaller rectangle and is rested upon the smaller one. But in the end both of are of same size. With one rectangle over the other.
Or in simple words... can an object's size be changed after it is drag at a particular location.
Is it possible...??

Re: Object resize when dragged into another object

Posted: Fri Aug 17, 2012 2:17 pm
by shaosean
yes.. You can either set the width and height properties, or (even easier) set the rectangle property.. setting the rectangle property will cause the control to get the same dimensions, as well as moving it to overlap with the other control

Code: Select all

set the width of control "a" to (the width of control "b")

Code: Select all

set the rectangle of control "a" to (the rectangle of control "b")

Re: Object resize when dragged into another object

Posted: Fri Aug 17, 2012 4:50 pm
by malte
And in animationEngine there is even a handler to do so (and animating it even). Please read the documentation on aeChangeRect.

Re: Object resize when dragged into another object

Posted: Sat Aug 18, 2012 8:33 am
by shaosean
You have thought of everything in there haven't you? ;-)

Re: Object resize when dragged into another object

Posted: Sat Aug 18, 2012 2:29 pm
by Surbhit29
Thanks a lot..... Malte and Shaosean....
It worked.... I used Animation Engine
Just one more thing.... Can same thing be done for Polygon....???
Is their any command like "aeChangePolygon"
What if I want to drag the Polygon into another polygon of different size....

Also what if I had to do a vice-versa of this.... Bringing the rectangle back to its original shape by dragging...

Re: Object resize when dragged into another object

Posted: Sat Aug 18, 2012 2:39 pm
by malte
Hi,

Changing the rect for a polygon should just scale it nicely. However it is adviseable to remember the original points of the poly (if it is not a regular poly)

cheers,

Malte

@Shao: almost ;-)

Re: Object resize when dragged into another object

Posted: Sat Aug 18, 2012 2:51 pm
by Surbhit29
Hi Malte..

I want to drag a Polygon into another Polygon..... Not a rectangle into Polygon.....
How can that be done...?

Re: Object resize when dragged into another object

Posted: Sat Aug 18, 2012 7:43 pm
by malte
Hi,

first of all, you need the logic when the drag is considdered being a valid drag. :-) This might be if the location of the poly is inside the area of the other poly, or already when both polys collide. Once you decided when you considder a drag being valid, you still can work with the rect property. Each control has a (bounding) rectangangle. So assuming both polys have the same shape you coud do a

set the rect of grc "aPoly" to the rect of grc "bPoly"

or use aeChangeRect to do it with a little animation.

Hth,

Malte

Re: Object resize when dragged into another object

Posted: Sun Aug 19, 2012 2:23 pm
by Surbhit29
Hi Malte..
Polygon is outside another polygon... I want to drag the polygon which is outside into another polygon... And when dragged inside.. The polygon which is outside changes its size and fit in the second polygon...
How can it be done using aeChangeRect..?

Re: Object resize when dragged into another object

Posted: Mon Aug 20, 2012 1:43 pm
by malte
aeChangeRect the long ID of grc "outerPoly",the rect of grc "innerPoly",tTimeInMillisecs

All the best,

Malte

Re: Object resize when dragged into another object

Posted: Tue Aug 21, 2012 5:56 am
by Surbhit29
Hi Malte
It is showing an error, "handler can't find handler near aeChangeRect"

Re: Object resize when dragged into another object

Posted: Tue Aug 21, 2012 9:13 am
by shaosean
Is animationEngine loaded?

Re: Object resize when dragged into another object

Posted: Tue Aug 21, 2012 2:36 pm
by Surbhit29
Ooopsss.... ;)

Re: Object resize when dragged into another object

Posted: Tue Aug 21, 2012 7:34 pm
by shaosean
Happens to the best of us ;)

Re: Object resize when dragged into another object

Posted: Wed Aug 22, 2012 7:16 am
by Surbhit29
Thnx Malte and Shaosean.....
You guys are helping me a lot..