Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-6147] Second pass to comb for layout #692

Merged
merged 1 commit into from
Nov 14, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions iphone/Classes/TiAnimation.m
Original file line number Diff line number Diff line change
Expand Up @@ -463,16 +463,16 @@ -(void)animate:(id)args
if ([view_ isKindOfClass:[TiUIView class]])
{ //TODO: Shouldn't we be updating the proxy's properties to reflect this?
TiUIView *uiview = (TiUIView*)view_;
LayoutConstraint *layout = [(TiViewProxy *)[uiview proxy] layoutProperties];
LayoutConstraint *layoutProperties = [(TiViewProxy *)[uiview proxy] layoutProperties];


BOOL doReposition = NO;

#define CHECK_LAYOUT_CHANGE(a) \
if (a!=nil && layout!=NULL) \
if (a!=nil && layoutProperties!=NULL) \
{\
autoreverseLayout.a = layout->a; \
layout->a = TiDimensionFromObject(a); \
autoreverseLayout.a = layoutProperties->a; \
layoutProperties->a = TiDimensionFromObject(a); \
doReposition = YES;\
}\
else \
Expand All @@ -485,12 +485,12 @@ -(void)animate:(id)args
CHECK_LAYOUT_CHANGE(height);
CHECK_LAYOUT_CHANGE(top);
CHECK_LAYOUT_CHANGE(bottom);
if (center!=nil && layout != NULL)
if (center!=nil && layoutProperties != NULL)
{
autoreverseLayout.centerX = layout->centerX;
autoreverseLayout.centerY = layout->centerY;
layout->centerX = [center xDimension];
layout->centerY = [center yDimension];
autoreverseLayout.centerX = layoutProperties->centerX;
autoreverseLayout.centerY = layoutProperties->centerY;
layoutProperties->centerX = [center xDimension];
layoutProperties->centerY = [center yDimension];
doReposition = YES;
}
else
Expand Down
14 changes: 7 additions & 7 deletions iphone/Classes/TiUIButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,19 @@ -(void)setImage_:(id)value
// if the layout is undefined or auto, we need to take the size of the image
//TODO: Refactor. This will cause problems if there's multiple setImages called,
//Since we change the values of the proxy.
LayoutConstraint *layout = [(TiViewProxy *)[self proxy] layoutProperties];
LayoutConstraint *layoutProperties = [(TiViewProxy *)[self proxy] layoutProperties];
BOOL reposition = NO;

if (TiDimensionIsUndefined(layout->width) || TiDimensionIsAuto(layout->width))
if (TiDimensionIsUndefined(layoutProperties->width) || TiDimensionIsAuto(layoutProperties->width))
{
layout->width.value = image.size.width;
layout->width.type = TiDimensionTypePixels;
layoutProperties->width.value = image.size.width;
layoutProperties->width.type = TiDimensionTypePixels;
reposition = YES;
}
if (TiDimensionIsUndefined(layout->height) || TiDimensionIsAuto(layout->height))
if (TiDimensionIsUndefined(layoutProperties->height) || TiDimensionIsAuto(layoutProperties->height))
{
layout->height.value = image.size.height;
layout->height.type = TiDimensionTypePixels;
layoutProperties->height.value = image.size.height;
layoutProperties->height.type = TiDimensionTypePixels;
}
if (reposition)
{
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ -(void)remove:(id)arg
[childView performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:NO];
if (layoutNeedsRearranging)
{
[self performSelectorOnMainThread:@selector(layout) withObject:nil waitUntilDone:NO modes:[NSArray arrayWithObject:NSRunLoopCommonModes]];
[self performSelectorOnMainThread:@selector(relayout) withObject:nil waitUntilDone:NO modes:[NSArray arrayWithObject:NSRunLoopCommonModes]];
}
}
}
Expand Down