Finally have the scaling working perfectly(?).

I had to hack around problems in GNUstep's bounds implementation (I don't
know if they're bugs or design limitations), but the fix was just a matter
of making sure the bounds matrix was correct: force the scale to 1 before
adjusting bounds, and then make sure the translation is scaled afterwards.
This commit is contained in:
Bill Currie 2010-09-22 17:49:30 +09:00
parent ad0cd004b7
commit d4d8c50c85

View file

@ -117,13 +117,6 @@ initWithFrame:
return scale; return scale;
} }
- (NSRect) adjustScroll: (NSRect)newVisible
{
Sys_Printf ("newVisible: %g %g %g %g\n",
newVisible.origin.x, newVisible.origin.y,
newVisible.size.width, newVisible.size.height);
return newVisible;
}
-setOrigin:(NSPoint)pt scale:(float) sc -setOrigin:(NSPoint)pt scale:(float) sc
{ {
@ -154,12 +147,20 @@ initWithFrame:
// size this view // size this view
[self setFrame: sframe]; [self setFrame: sframe];
if (_boundsMatrix) { if (_boundsMatrix) {
//FIXME workaround for a bug in GNUstep //FIXME workaround for a bug (?) in GNUstep
NSAffineTransformStruct t = [_boundsMatrix transformStruct]; NSAffineTransformStruct t = [_boundsMatrix transformStruct];
t.m11 = t.m22 = 1; t.m11 = t.m22 = 1;
t.m12 = t.m21 = 0;
[_boundsMatrix setTransformStruct: t]; [_boundsMatrix setTransformStruct: t];
} }
[self setBounds: bounds]; [self setBounds: bounds];
if (_boundsMatrix) {
//FIXME workaround for a bug (?) in GNUstep
NSAffineTransformStruct t = [_boundsMatrix transformStruct];
t.tX *= scale;
t.tY *= scale;
[_boundsMatrix setTransformStruct: t];
}
//[self setPostsFrameChangedNotifications:YES]; //[self setPostsFrameChangedNotifications:YES];
//[self setPostsBoundsChangedNotifications:YES]; //[self setPostsBoundsChangedNotifications:YES];