views:

34

answers:

0
- (void)mouseDragged:(NSEvent *)theEvent {

clickPoint  =    [theEvent locationInWindow];
newPoint.x  =    centerPoint.x - clickPoint.x ;
newPoint.y  =    centerPoint.y - clickPoint.y ;

NSLog(@"Click Point : X=%f Y=%f",clickPoint.x,clickPoint.y);
NSLog(@"Center Point : Click X=%f Y=%f",centerPoint.x,centerPoint.y);
[[[self enclosingScrollView] documentView] scrollPoint:newPoint];    }

Here the centerPoint is:

centerPoint.x = [self frame].size.width/2;
centerPoint.y = [self frame].size.height/2;

When I drag the mouse anywhere in the documentView, It always gets the center of the documentView... How to get the position in the documentView where the mouse has been pinched??

Help Appreciated...