Fix to ASEnvironment

This commit is contained in:
Hannah Troisi
2016-04-20 15:02:54 -07:00
parent c72d59f2d6
commit ec447b84da
3 changed files with 13 additions and 5 deletions

View File

@@ -37,9 +37,11 @@
insetSpec.neverShouldVisualize = YES;
// propogate child's layoutSpec properties to the inset that we are adding
insetSpec.flexGrow = _layoutSpec.flexGrow;
insetSpec.flexShrink = _layoutSpec.flexShrink;
insetSpec.alignSelf = _layoutSpec.alignSelf;
// insetSpec.flexGrow = _layoutSpec.flexGrow;
// insetSpec.flexShrink = _layoutSpec.flexShrink;
// insetSpec.alignSelf = _layoutSpec.alignSelf;
NSLog(@"%@: vizNode = %d, child = %d", self, insetSpec.flexGrow, _layoutSpec.flexGrow);
return insetSpec;
}

View File

@@ -15,7 +15,7 @@
//#define LOG(...) NSLog(__VA_ARGS__)
#define LOG(...)
#define AS_SUPPORT_PROPAGATION NO
#define AS_SUPPORT_PROPAGATION YES
BOOL ASEnvironmentStatePropagationEnabled()
{
@@ -139,6 +139,9 @@ ASEnvironmentState ASEnvironmentMergeObjectAndState(ASEnvironmentState environme
if (parentLayoutOptionsState.flexGrow == defaultState.flexGrow) {
parentLayoutOptionsState.flexGrow = layoutOptionsState.flexGrow;
}
if (parentLayoutOptionsState.flexShrink == defaultState.flexShrink) {
parentLayoutOptionsState.flexShrink = layoutOptionsState.flexShrink;
}
if (ASRelativeDimensionEqualToRelativeDimension(parentLayoutOptionsState.flexBasis, defaultState.flexBasis)) {
parentLayoutOptionsState.flexBasis = layoutOptionsState.flexBasis;
}

View File

@@ -64,6 +64,8 @@
_photoDescriptionLabel = [[ASTextNode alloc] init];
_photoDescriptionLabel.attributedString = [self descriptionAttributedStringWithFontSize:FONT_SIZE];
_photoDescriptionLabel.maximumNumberOfLines = 3;
}
return self;
@@ -95,7 +97,8 @@
ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init];
spacer.flexGrow = YES;
spacer.flexShrink = YES;
spacer.flexShrink = YES; // FIXME: this overrides stuff :) THIS IS A SYSTEMIC ISSUE - can we make layoutSpecThatFits only run once? cache layoutSpec, just use new constrainedSize, don't put properties in layoutSpecThatFits
// separate the idea of laying out and rerunning with new constrainedSize
ASStackLayoutSpec *headerStack = [ASStackLayoutSpec horizontalStackLayoutSpec];
headerStack.alignItems = ASStackLayoutAlignItemsCenter; // center items vertically in horizontal stack