Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

skunkworker

macrumors regular
Original poster
Sep 9, 2007
182
20
I've got a NSClipView inside of NSScrollView, showing a custom view. Whenever I change the "gridsize" ( a variable that adjusts the size of everything) it locks the top left corner and if you move around and change the "gridsize" it doesn't properly zoom to where you moved.
Is there any easy way to fix this?

Code:
-(void) setGridSize: (int) size {
    m_GridSize = size;
    
    NSSize frameSize = NSMakeSize((m_PlayFieldData.size.width+2)*m_GridSize, (m_PlayFieldData.size.height+2)*m_GridSize);
    frameSize.width = MAX(frameSize.width, self.superview.frame.size.width);
    frameSize.height = MAX(frameSize.height, self.superview.frame.size.height);   	
	
    [self setFrameSize: frameSize]; 
	NSClipView *clipView = (NSClipView *)[self superview];
	NSScrollView *scrollview = (NSScrollView *)[clipView superview];
	
	[scrollview reflectScrolledClipView: clipView];	
	
    [self setNeedsDisplay: YES];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.