PaddingPercent Interface

Specifies padding to apply around a view volume for methods like ViewState.lookAtVolume and Viewport.zoomToElements, expanding or contracting the viewed volume by a fraction of its original size. The margin values represent a fraction of the view volume's width (for PaddingPercent.left and PaddingPercent.right) or height (for PaddingPercent.top and PaddingPercent.bottom). Positive values add additional volume along the specified edge, negative values subtract it, and zero values have no effect. All properties default to zero if undefined. For example, if the original volume has a width of 100 and the padding is specified as { left: 1 }, the width will be doubled to 200, with 100 padding on the left side of the view. If a padding of 0.25 is specified for each of PaddingPercent.left, PaddingPercent.right, PaddingPercent.top, and PaddingPercent.bottom, then the final volume will be inset such that 25% of the original volume falls outside of the view on each side.

note Margins are only applied in 2d views, or 3d views in which the camera has been turned off.

see MarginOptions.paddingPercent.

extensions

Properties

Name Type Description
bottom undefined | number    
left undefined | number    
right undefined | number    
top undefined | number    

Defined in

Last Updated: 30 November, 2023