views:

103

answers:

1
- (void)mouseDragged:(NSEvent *)theEvent {
    NSSize dynamicImageSize;
    dynamicImageSize = [[self image] size];
    NSSize contentSize = [(NSScrollView*)[[self superview] superview] contentSize];
    if(dynamicImageSize.height > contentSize.height || dynamicImageSize.width > contentSize.width)
    {
        float x = startOrigin.x - ([theEvent locationInWindow].x - startPt.x);
        float y = startOrigin.y - ([theEvent locationInWindow].y - startPt.y);
        [self scrollPoint:NSMakePoint(x, y)];
    }
}

In the above code I need to animate the scrolling. How can I achieve this? Thanks.

+1  A: 

I'm not sure if this is a supported animation type, but have you tried calling through the animator proxy object?

eg. [[self animator] scrollPoint:NSMakePoint(x, y)];

Ashley Clark
Nope, that won't work. That's not a supported animatable property (although perhaps it would be a good enhancement request?).
kperryua