Visual Console Client: minor fix

Former-commit-id: 7e20bc7972f98e2cfe1a991d82cbf2dbc12c21de
This commit is contained in:
Alejandro Gallardo Escobar 2019-03-08 13:39:17 +01:00
parent af26c7cdfc
commit c0f8c289e6
1 changed files with 4 additions and 1 deletions

View File

@ -53,7 +53,10 @@ export default class Box extends Item<BoxProps> {
// Border.
if (this.props.borderWidth > 0) {
box.style.borderStyle = "solid";
box.style.borderWidth = `${this.props.borderWidth}px`;
// Control the max width to prevent this item to expand beyond its parent.
const maxBorderWidth = Math.min(this.props.width, this.props.height) / 2;
const borderWidth = Math.min(this.props.borderWidth, maxBorderWidth);
box.style.borderWidth = `${borderWidth}px`;
if (this.props.borderColor) {
box.style.borderColor = this.props.borderColor;