I’ve stumped myself on this one and the answer is probably right in front of me. Here is a basic map that is masked and bound by the dimensions of the mask (boundary_box). Upon execution the map is at 100% and it is not draggable. pressing the + key enlarges the map and it is now draggable within the limits of the bounding_box). Know the problem… The - key reduces the map back to 100% and snaps back to it’s center position
If the map is scaled up and moved to say the upper right corner then reduced, the map scales down based on its current x, y position then snaps back to center. How could I proportionaly scale down and move the map back to center without having any background whitespace?
i.e. as _xscale and _yscale approach 100% this._x & this._y approach _root.bounding_box._x & _root.bounding_box._y
I guess what I can’t figure out is does it make sense to trak the map _x & _y back to the _x & _y of the bounding_box or to find the edged of the map as it relates to the bounding_box and scale down fron there
We are working on a similar application that has the same requirements for a scaleable object constrained inside the bounds of a framing box. You might try getting someone on your team to see if they can track the edges of the scaleable box in relation to the fixed edges of the framing box where as the scaleable box shrinks towards the size of the bounding box its edges would be locked into place when they intersected with an edge of the framing box.
We haven’t found an exact way to implement this in our project yet. If anyone else knows how to do this it would be a great help to both of these projects.:cyclops:
Oh k, I think I’ve got a solution for you. When do do a zoom in what you need to do is do some math. When you do a drag get the starting coordinates of x,y and then the end coordinates.
Also, keep in mind that you need to do this probably in a 2-dimensional array because they can move this object multiple times before they zoom back out. When they zoom back out however, have it add the coordinates from the array together and then find the difference from the total in the array and the original position of the object. From that you can reposition it when the (-) key is hit.
I would try to actually do this for you but I don’t have time. I hope this works out and my theory will work.