Skip navigation.
 
mlRe: Zooming images in NSView
FROM : Chris Giordano
DATE : Sat Dec 11 21:56:02 2004

All,

On Dec 10, 2004, at 7:30 PM, John C. Randolph wrote:

> On Dec 10, 2004, at 3:27 PM, Ricky Sharp wrote:
>

>> On Dec 10, 2004, at 1:36 PM, John C. Randolph wrote:
>>
>>

>>>> The simplest way is to shrink the bounds rect of the NSView by your
>>>> zoom factor.
>>>>

>>> And here's an example of how to do so:
>>>
>>> http://dts.apple.com/qa/QA1346/qa1346.html
>>>

>> The link should be
>> <http://developer.apple.com/qa/qa2004/qa1346.html>, unless of course
>> you work for Apple :)

> Whoops! That will teach me to drop a link into a mail message without
> reading it..
>
> -jcr
>


Thought I'd let everyone know of what looks like a bug in the
-scalePercent method in the sample code.

The original implementation returns a result that is roughly the
inverse of what one would expect.  That is, one gets 50% instead of
200%, 25% instead of 400%, 200% instead of 50%, etc.

The fix is simple: divide 1 by the scale's width before multiplying by
100.

- (float) scalePercent
{
   return (1.0 / [self scale].width) * 100.0;
}

Reported this morning: <rdar://3916447>

Related mailsAuthorDate
mlZooming images in NSView padmanaban gandhi Dec 9, 17:27
mlZooming images in NSView Joe Chan Dec 10, 04:37
mlRe: Zooming images in NSView Rick Kitts Dec 10, 15:03
mlRe: Zooming images in NSView John C. Randolph Dec 10, 20:36
mlRe: Zooming images in NSView Ricky Sharp Dec 11, 00:27
mlRe: Zooming images in NSView John C. Randolph Dec 11, 01:30
mlRe: Zooming images in NSView Chris Giordano Dec 11, 21:56
mlRe: Zooming images in NSView John C. Randolph Dec 12, 01:56
mlRe: Zooming images in NSView John C. Randolph Dec 12, 02:05