More NSScrollView auto layout fixes.
This commit is contained in:
parent
b65175a19c
commit
e2266ab577
|
@ -164,6 +164,7 @@ void singleChildConstraintsSetMargined(struct singleChildConstraints *c, int mar
|
||||||
void scrollViewConstraintsEstablish(struct scrollViewConstraints *c, NSScrollView *sv, BOOL hscroll, BOOL vscroll, NSString *desc)
|
void scrollViewConstraintsEstablish(struct scrollViewConstraints *c, NSScrollView *sv, BOOL hscroll, BOOL vscroll, NSString *desc)
|
||||||
{
|
{
|
||||||
NSView *cv, *dv;
|
NSView *cv, *dv;
|
||||||
|
NSLayoutRelation rel;
|
||||||
|
|
||||||
scrollViewConstraintsRemove(c, sv);
|
scrollViewConstraintsRemove(c, sv);
|
||||||
cv = [sv contentView];
|
cv = [sv contentView];
|
||||||
|
@ -186,22 +187,26 @@ void scrollViewConstraintsEstablish(struct scrollViewConstraints *c, NSScrollVie
|
||||||
[c->documentTop retain];
|
[c->documentTop retain];
|
||||||
|
|
||||||
c->hscroll = hscroll;
|
c->hscroll = hscroll;
|
||||||
|
rel = NSLayoutRelationGreaterThanOrEqual;
|
||||||
|
if (!c->hscroll)
|
||||||
|
rel = NSLayoutRelationEqual;
|
||||||
c->documentTrailing = mkConstraint(dv, NSLayoutAttributeTrailing,
|
c->documentTrailing = mkConstraint(dv, NSLayoutAttributeTrailing,
|
||||||
NSLayoutRelationEqual,
|
rel,
|
||||||
cv, NSLayoutAttributeTrailing,
|
cv, NSLayoutAttributeTrailing,
|
||||||
1, 0,
|
1, 0,
|
||||||
[desc stringByAppendingString:@"document trailing constraint"]);
|
[desc stringByAppendingString:@"document trailing constraint"]);
|
||||||
if (!c->hscroll)
|
|
||||||
[sv addConstraint:c->documentTrailing];
|
[sv addConstraint:c->documentTrailing];
|
||||||
[c->documentTrailing retain];
|
[c->documentTrailing retain];
|
||||||
|
|
||||||
c->vscroll = vscroll;
|
c->vscroll = vscroll;
|
||||||
|
rel = NSLayoutRelationGreaterThanOrEqual;
|
||||||
|
if (!c->vscroll)
|
||||||
|
rel = NSLayoutRelationEqual;
|
||||||
c->documentBottom = mkConstraint(dv, NSLayoutAttributeBottom,
|
c->documentBottom = mkConstraint(dv, NSLayoutAttributeBottom,
|
||||||
NSLayoutRelationEqual,
|
rel,
|
||||||
sv, NSLayoutAttributeBottom,
|
sv, NSLayoutAttributeBottom,
|
||||||
1, 0,
|
1, 0,
|
||||||
[desc stringByAppendingString:@"document bottom constraint"]);
|
[desc stringByAppendingString:@"document bottom constraint"]);
|
||||||
if (!c->vscroll)
|
|
||||||
[sv addConstraint:c->documentBottom];
|
[sv addConstraint:c->documentBottom];
|
||||||
[c->documentBottom retain];
|
[c->documentBottom retain];
|
||||||
}
|
}
|
||||||
|
@ -219,13 +224,11 @@ void scrollViewConstraintsRemove(struct scrollViewConstraints *c, NSScrollView *
|
||||||
c->documentTop = nil;
|
c->documentTop = nil;
|
||||||
}
|
}
|
||||||
if (c->documentTrailing != nil) {
|
if (c->documentTrailing != nil) {
|
||||||
if (!c->hscroll)
|
|
||||||
[sv removeConstraint:c->documentTrailing];
|
[sv removeConstraint:c->documentTrailing];
|
||||||
[c->documentTrailing release];
|
[c->documentTrailing release];
|
||||||
c->documentTrailing = nil;
|
c->documentTrailing = nil;
|
||||||
}
|
}
|
||||||
if (c->documentBottom != nil) {
|
if (c->documentBottom != nil) {
|
||||||
if (!c->vscroll)
|
|
||||||
[sv removeConstraint:c->documentBottom];
|
[sv removeConstraint:c->documentBottom];
|
||||||
[c->documentBottom release];
|
[c->documentBottom release];
|
||||||
c->documentBottom = nil;
|
c->documentBottom = nil;
|
||||||
|
|
Loading…
Reference in New Issue