How to use the @bentley/ui-core.Rectangle function in @bentley/ui-core

To help you get started, we’ve selected a few @bentley/ui-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / zones / manager / Zones.ts View on Github external
public getInitialBounds(zoneId: WidgetZoneId, props: ZonesManagerProps): RectangleProps {
    const zonesBounds = Rectangle.create(props.zonesBounds);
    const rootBounds = Rectangle.createFromSize(zonesBounds.getSize());
    if (zoneId === 8 && props.isInFooterMode) {
      return new Rectangle(rootBounds.left, rootBounds.bottom, rootBounds.right, rootBounds.bottom);
    }

    const rootSize = rootBounds.getSize();
    const cell = getZoneCell(zoneId);
    const left = rootBounds.left + rootSize.width * cell.col / 3;
    const right = rootBounds.left + rootSize.width * (cell.col + 1) / 3;
    const top = rootBounds.top + rootSize.height * cell.row / 3;
    const bottom = rootBounds.top + rootSize.height * (cell.row + 1) / 3;
    const zoneBounds = new Rectangle(left, top, right, bottom);

    const zone = props.zones[zoneId];
    if (zone.widgets.length === 1 && zone.widgets[0] === zone.id)
      return zoneBounds;

    const mergedBounds = zone.widgets.reduce((acc, wId) => {
      if (zoneId === wId)
github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / zones / manager / Zones.ts View on Github external
public getInitialBounds(zoneId: WidgetZoneId, props: ZonesManagerProps): RectangleProps {
    const zonesBounds = Rectangle.create(props.zonesBounds);
    const rootBounds = Rectangle.createFromSize(zonesBounds.getSize());
    if (zoneId === 8 && props.isInFooterMode) {
      return new Rectangle(rootBounds.left, rootBounds.bottom, rootBounds.right, rootBounds.bottom);
    }

    const rootSize = rootBounds.getSize();
    const cell = getZoneCell(zoneId);
    const left = rootBounds.left + rootSize.width * cell.col / 3;
    const right = rootBounds.left + rootSize.width * (cell.col + 1) / 3;
    const top = rootBounds.top + rootSize.height * cell.row / 3;
    const bottom = rootBounds.top + rootSize.height * (cell.row + 1) / 3;
    const zoneBounds = new Rectangle(left, top, right, bottom);

    const zone = props.zones[zoneId];
    if (zone.widgets.length === 1 && zone.widgets[0] === zone.id)
      return zoneBounds;

    const mergedBounds = zone.widgets.reduce((acc, wId) => {
      if (zoneId === wId)
        return acc;

      const bounds = this.getInitialBounds(wId, props);
      return acc.outerMergeWith(bounds);
    }, zoneBounds);
    return mergedBounds.toProps();
  }
github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / widget / rectangular / tab / Tab.tsx View on Github external
public getBounds(): RectangleProps {
    if (!this._tab.current)
      return new Rectangle();
    return this._tab.current.getBoundingClientRect();
  }
github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / widget / Stacked.tsx View on Github external
public getBounds(): RectangleProps {
    if (!this._widget.current)
      return new Rectangle();
    return this._widget.current.getBoundingClientRect();
  }
github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / base / WithContainIn.tsx View on Github external
public getContainerBounds(): Rectangle {
      if (!this.props.container)
        return new Rectangle(0, 0, window.innerWidth, window.innerHeight);

      const containerBounds = this.props.container.getBoundingClientRect();
      return new Rectangle(containerBounds.left, containerBounds.top, containerBounds.right, containerBounds.bottom);
    }
github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / widget / ToolSettings.tsx View on Github external
public getBounds(): RectangleProps {
    if (!this._widget.current)
      return new Rectangle();
    return this._widget.current.getBoundingClientRect();
  }
github imodeljs / imodeljs / ui / ninezone / src / ui-ninezone / base / WithContainIn.tsx View on Github external
public getContainerBounds(): Rectangle {
      if (!this.props.container)
        return new Rectangle(0, 0, window.innerWidth, window.innerHeight);

      const containerBounds = this.props.container.getBoundingClientRect();
      return new Rectangle(containerBounds.left, containerBounds.top, containerBounds.right, containerBounds.bottom);
    }