mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Fix coordinate conversion code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3778 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c4eed80d9a
commit
ea86b25c57
2 changed files with 35 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Feb 22 6:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* NSView.m: Tidied coordinate conversion code to use new system with
|
||||
a cached conversion matrix to convert to/from window coordinates.
|
||||
|
||||
1999-02-21 Michael Hanni <mhanni@sprintmail.com>
|
||||
|
||||
* Headers/gnustep/gui/NSRulerView.h: added (note: not implemented)
|
||||
|
|
|
@ -629,17 +629,24 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
{
|
||||
NSPoint new;
|
||||
PSMatrix *matrix;
|
||||
NSPoint yyy;
|
||||
PSMatrix *xxx;
|
||||
|
||||
if (!aView)
|
||||
aView = [window contentView];
|
||||
|
||||
xxx = [[aView _windowMatrix] copy];
|
||||
[xxx inverse];
|
||||
(*concatImp)(xxx, concatSel, [self _windowMatrix]);
|
||||
yyy = [xxx pointInMatrixSpace: aPoint];
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* Convert from aView to window
|
||||
*/
|
||||
matrix = [aView _windowMatrix];
|
||||
new = [matrix pointInMatrixSpace: aPoint];
|
||||
/*
|
||||
* Convert from window to self.
|
||||
*/
|
||||
matrix = [[self _windowMatrix] copy];
|
||||
[matrix inverse];
|
||||
new = [matrix pointInMatrixSpace: new];
|
||||
[matrix release];
|
||||
#else
|
||||
if ([self isDescendantOf: aView])
|
||||
{
|
||||
NSMutableArray *path;
|
||||
|
@ -664,8 +671,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
new = [aView convertPoint: aPoint toView: nil];
|
||||
new = [self convertPoint: new fromView: nil];
|
||||
}
|
||||
|
||||
// NSAssert(NSEqualPoints(new, yyy), NSInternalInconsistencyException);
|
||||
#endif
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -719,6 +725,20 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
if (!aView)
|
||||
aView = [window contentView];
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* Convert from aView to window
|
||||
*/
|
||||
matrix = [aView _windowMatrix];
|
||||
new = [matrix sizeInMatrixSpace: aSize];
|
||||
/*
|
||||
* Convert from window to self.
|
||||
*/
|
||||
matrix = [[self _windowMatrix] copy];
|
||||
[matrix inverse];
|
||||
new = [matrix sizeInMatrixSpace: new];
|
||||
[matrix release];
|
||||
#else
|
||||
if ([self isDescendantOf: aView])
|
||||
{
|
||||
NSArray* path = [self _pathBetweenSubview: self toSuperview: aView];
|
||||
|
@ -739,7 +759,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
|||
new = [aView convertSize: aSize toView: nil];
|
||||
new = [self convertSize: new fromView: nil];
|
||||
}
|
||||
|
||||
#endif
|
||||
return new;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue