Margins Type

The Botfather engine provides an inbuild Margins type. Use it to represents margins in a convenient way.

Table of contents

Margins type instanciation


New Margins objects can be created providing the left, right, top and bottom margin values (in that order) or nothing. Providing nothing results in an null margins object with all margins values being 0.

Margins type methods


Margins.isNull();

Returns true if all margins are is 0; otherwise returns false.

Margins.getTop();

Returns the top margin.

Margins.setTop(top);

Sets the Top margin to top.

Margins.getLeft();

Returns the left margin.

Margins.setLeft(left);

Sets the left margin to left.

Margins.getRight();

Returns the right margin.

Margins.setRight(right);

Sets the right margin to right.

Margins.getBottom();

Returns the bottom margin.

Margins.setBottom(bottom);

Sets the bottom margin to bottom.

Margins.marginsAdded(other_margins)

Returns a Margins object that is the sum of other_margins and this margins object; each component is added separately.

Margins.marginsSubtracted(other_margins)

Returns a Margins object that is formed by subtracting other_margins from this margins object; each component is subtracted separately.