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-8451: recalculate bounds when border is changed, also added cap for border padding #1921

Merged
merged 1 commit into from Apr 5, 2012
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -107,8 +107,11 @@ protected void onBoundsChange(Rect bounds) {

outerRect.set(bounds);
int padding = 0;
int maxPadding = 0;
if (border != null) {
padding = (int)border.width;
//cap padding to current bounds
maxPadding = (int) Math.min(outerRect.right/2, outerRect.bottom/2);
padding = (int) Math.min((int)border.width, maxPadding);
}
innerRect.set(bounds.left+padding, bounds.top+padding, bounds.right-padding, bounds.bottom-padding);
if (background != null) {
Expand Down Expand Up @@ -271,6 +274,7 @@ public void setAlpha(int alpha)
}
}


// public Drawable getBackgroundDrawable() {
// return background;
// }
Expand Down
Expand Up @@ -855,6 +855,8 @@ private void handleBorderProperty(String property, Object value)
} else if (property.equals(TiC.PROPERTY_BORDER_WIDTH)) {
border.setWidth(TiConvert.toFloat(value));
}
//recalculate bounds since border is changed.
background.onBoundsChange(background.getBounds());
applyCustomBackground();
}

Expand Down