Proportional scaling

Ray Horsley ray at linkitonline.com
Tue Sep 21 17:23:44 EDT 2004


Ah yes.  Now I see what you want.  How about this.  Pick either one, 
say width, and adjust it by (the amount you've adjusted height) times 
(width divided by height).  In your rectangle laying on its side 
example, if it's 100 pixels wide by 50 tall and you want an increase in 
10 pixels of height to force an increase in 20 pixels for the width (so 
width is still double the height) your adjustment of 10 pixels in 
height multiplied by 2 (100 divided by 50) should  do the trick.  
Running into negative numbers shouldn't matter, and you can always flip 
whether it's height or width change which is the determining factor.  
That is, you can always grab the user's first movement of the mouse, 
whether it's up/down or left/right, to determine whether height or 
width is dictating change.

Ray Horsley
Developer, LinkIt! Software



On Tuesday, September 21, 2004, at 09:47  AM, Simon Lord wrote:

> This would only work for an object who's height and width are the 
> same.  Objects like a rectangle on it's side will get wider at a 
> faster rate than they will get taller.  That's where the math kinda 
> runs away from me (and when fond memories of me doodling in 6th grade 
> math come to mind).
>
>
>
> On Sep 21, 2004, at 2:22 PM, Ray Horsley wrote:
>
>> Simon,
>>
>> Wouldn't this be just a matter of making sure you increase or 
>> decrease the object's width the same number of pixels its height is 
>> increased or decreased for every change in size that's made, or am I 
>> not understanding your question?
>>
>> Ray Horsley
>> Developer, LinkIt! Software
>>
>> On Monday, September 20, 2004, at 02:46  PM, Simon Lord wrote:
>>
>>> I have an abject on my card which can be scaled at runtime, the next 
>>> step is to get this object to scale proportionally using it's 
>>> current H x W as the aspect ratio when the shiftKey is down.
>>>
>>> So if the object is currently shaped like a rectangle, when I hold 
>>> the shiftKey down and continue dragging the object will maintain the 
>>> same aspect ratio at the time I held the shiftKey down.
>>>
>>> Unfortunately I'm at a lose at to where to even start the math on 
>>> this.
>>>
>>> Sincerely,
>>> Simon
>>>
>>> _______________________________________________
>>> metacard mailing list
>>> metacard at lists.runrev.com
>>> http://lists.runrev.com/mailman/listinfo/metacard
>>>
>>
>> _______________________________________________
>> metacard mailing list
>> metacard at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/metacard
>>
>>
> Sincerely,
> Simon
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>



More information about the metacard mailing list