UNPKG

@itwin/core-frontend

Version:
41 lines 1.91 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Views */ Object.defineProperty(exports, "__esModule", { value: true }); exports.MarginPercent = void 0; const core_geometry_1 = require("@itwin/core-geometry"); /** Specifies margins to apply around a view volume for methods like [[ViewState.lookAtVolume]] and [[Viewport.zoomToElements]], expanding the * viewed volume by a percentage of its original size to add extra space around one or more edges. * The margin values represent a fraction of the view volume's width (for [[left]] and [[right]]) or height (for [[top]] and [[bottom]]). * The values are clamped to the range 0 through 0.25. * @note Margins are only applied in 2d views, or 3d views in which the camera has been turned off. * @note The way in which the extra space is computed is somewhat unintuitive and may lead to surprising results. * @see [[MarginOptions.marginPercent]]. * @see [[PaddingPercent]] for a more predictable way of adjusting the viewed volume. * @public * @extensions */ class MarginPercent { left; top; right; bottom; constructor(left, top, right, bottom) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; const limitMargin = (val) => core_geometry_1.Geometry.clamp(val, 0.0, 0.25); this.left = limitMargin(left); this.top = limitMargin(top); this.right = limitMargin(right); this.bottom = limitMargin(bottom); } } exports.MarginPercent = MarginPercent; //# sourceMappingURL=MarginPercent.js.map