Skip to content

Commit

Permalink
ViewProxy: Added setMargin
Browse files Browse the repository at this point in the history
  • Loading branch information
reportmill committed Aug 26, 2021
1 parent c6ecc1e commit 0fbb1cc
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/snap/view/ViewProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class ViewProxy<T extends View> extends Rect {
// The border
private Border _border;

// The margin
private Insets _margin;

// The Padding
private Insets _padding;

Expand All @@ -30,9 +33,6 @@ public class ViewProxy<T extends View> extends Rect {
// The vertical position this view would prefer to take when inside a pane
private VPos _leanY;

// The margin
private Insets _margin;

// Whether view should grow in X or Y
private Boolean _growX, _growY;

Expand Down Expand Up @@ -211,6 +211,24 @@ public Insets getBorderInsets()
return border != null ? border.getInsets() : Insets.EMPTY;
}

/**
* Returns the margin.
*/
public Insets getMargin()
{
if (_margin != null) return _margin;
_margin = _view != null ? _view.getMargin() : Insets.EMPTY;
return _margin;
}

/**
* Sets the margin.
*/
public void setMargin(Insets theIns)
{
_margin = theIns;
}

/**
* Returns the padding.
*/
Expand Down Expand Up @@ -286,16 +304,6 @@ public VPos getLeanY()
return _leanY;
}

/**
* Returns the margin.
*/
public Insets getMargin()
{
if (_margin != null) return _margin;
_margin = _view != null ? _view.getMargin() : Insets.EMPTY;
return _margin;
}

/**
* Returns whether view grows width.
*/
Expand Down

0 comments on commit 0fbb1cc

Please sign in to comment.