Skip to content

API / geotoolkit / layout / LayoutHelper / LayoutHelper

Class: LayoutHelper

layout.LayoutHelper.LayoutHelper

This utility class provides functions used by LayoutStyle implementations

Table of contents

Constructors
  • [new LayoutHelper()](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.layout.layouthelper.layouthelper.md#new layouthelper())
Methods

Contents

Constructors

new LayoutHelper()

• new LayoutHelper()

Methods

getBottomMargin

▸ Static getBottomMargin(node, totalHeight?): number

Returns bottom margin

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalHeightnumberparent height of the container or layoutable area

Returns

number


getDesiredHeight

▸ Static getDesiredHeight(node, totalHeight?, processInvisible?): number

Converts desired height of the "node" layoutable component to number if possible

Example

node.setDesiredHeight('15');
const h1 = LayoutHelper.getDesiredHeight(node); // So, h1==15.
node.setDesiredHeight('15%');
const h2 = LayoutHelper.getDesiredHeight(node, 200); // So, h2==30.

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalHeightnumberparent height of the container or layoutable area
Optional processInvisiblebooleanask to don't skip invisible nodes

Returns

number

converted value; or 0 if the node is not visible; or "undefined" the conversion failed.


getDesiredMaxHeight

▸ Static getDesiredMaxHeight(node, totalHeight?): number

Gets the Maximum Height of layoutable component

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalHeightnumberparent height of the container or layoutable area

Returns

number

Maximum Height


getDesiredMaxWidth

▸ Static getDesiredMaxWidth(node, totalWidth?): number

Gets the Maximum Width of layoutable component

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalWidthnumberparent width of the container or layoutable area

Returns

number

Maximum Width


getDesiredMinHeight

▸ Static getDesiredMinHeight(node, totalHeight?): number

Gets the Minimum Height of layoutable component

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalHeightnumberparent height of the container or layoutable area

Returns

number

Minimum Height


getDesiredMinWidth

▸ Static getDesiredMinWidth(node, totalWidth?): number

Gets the Minimum Width of layoutable component

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalWidthnumberparent width of the container or layoutable area

Returns

number

Minimum Width


getDesiredWidth

▸ Static getDesiredWidth(node, totalWidth?, processInvisible?): number

Converts desired width of the "node" layoutable component to number if possible

Example

node.setDesiredWidth('15');
const w1 = LayoutHelper.getDesiredWidth(node); // So, w1==15.
node.setDesiredWidth('15%');
const w2 = LayoutHelper.getDesiredWidth(node, 200); // So, w2==30.

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalWidthnumberparent width of the container or layoutable area
Optional processInvisiblebooleanask to don't skip invisible nodes

Returns

number

converted value; or 0 if the node is not visible; or "undefined" the conversion failed.


getFlexGrow

▸ Static getFlexGrow(node): number

Gets the Flex Grow of layoutable component

Parameters

Name Type Description
nodeILayoutablelayoutable component

Returns

number

Flex Grow


getFlexShrink

▸ Static getFlexShrink(node): number

Gets the Flex Shrink of layoutable component

Parameters

Name Type Description
nodeILayoutablelayoutable component

Returns

number

Flex Shrink


getLeftMargin

▸ Static getLeftMargin(node, totalWidth?): number

Returns left margin

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalWidthnumberparent width of the container or layoutable area

Returns

number


getPreferredStyle

▸ Static getPreferredStyle(style, rect?): LayoutStyle<string | number&gt;

Update layout style preferred size based on size constrains from calculated size

Parameters

Name Type Description
styleLayoutStyle<string | number&gt;style to be updated
Optional rectRect | Dimensiondesired rect to layout

Returns

LayoutStyle<string | number&gt;


getRightMargin

▸ Static getRightMargin(node, totalWidth?): number

Returns right margin

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalWidthnumberparent width of the container or layoutable area

Returns

number


getTopMargin

▸ Static getTopMargin(node, totalHeight?): number

Returns top margin

Parameters

Name Type Description
nodeILayoutablelayoutable component
Optional totalHeightnumberparent height of the container or layoutable area

Returns

number


invalidateLayout

▸ Static invalidateLayout(item, propagate?): void

Notify that layout is invalidated. Send event Events.LayoutInvalidated

Parameters

Name Type Description
itemCompositeNode<Node&gt;item
Optional propagatebooleanpropagate invalidate layout to parent

Returns

void


invalidateParentLayout

▸ Static invalidateParentLayout(item, propagate?): void

Notify that layout is invalidated. Send event Events.LayoutInvalidated

Parameters

Name Type Description
itemNodeitem
Optional propagatebooleanpropagate invalidate layout to parent

Returns

void


setDesiredTextSize

▸ Static setDesiredTextSize(text, groupText, location): void

Sets desired size of text group, depends on text metrics

Parameters

Name Type Description
textTexttext
groupTextGroup<Node&gt;group with this text
locationAnnotationLocationlocation of text

Returns

void