How to use the @bentley/ui-abstract.RelativePosition.Bottom function in @bentley/ui-abstract

To help you get started, we’ve selected a few @bentley/ui-abstract 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 / test-apps / ui-test-app / src / frontend / appui / frontstages / ViewsFrontstage.tsx View on Github external
this._toolRelativePosition = RelativePosition.Left;
        changed = true;
        break;
      case 38:
        details.briefMessage = "Up pressed";
        this._toolRelativePosition = RelativePosition.Top;
        changed = true;
        break;
      case 39:
        details.briefMessage = "Right pressed";
        this._toolRelativePosition = RelativePosition.Right;
        changed = true;
        break;
      case 40:
        details.briefMessage = "Down pressed";
        this._toolRelativePosition = RelativePosition.Bottom;
        changed = true;
        break;
      case 27:  // Escape
        this._handleTool4Dismiss();
        break;
    }

    if (changed) {
      IModelApp.notifications.outputMessage(details);
      IModelApp.notifications.updatePointerMessage({ x: CursorInformation.cursorX, y: CursorInformation.cursorY }, this._toolRelativePosition);
    }
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / frontstages / ViewsFrontstage.tsx View on Github external
iconSpec: "icon-placeholder", labelKey: "SampleApp:buttons.addCursorPopups", execute: async () => {
        CursorPopupManager.open("testR1", Hello World!, CursorInformation.cursorPosition, new Point(40, 20), RelativePosition.Right, 10);
        CursorPopupManager.open("testBR1", Hello World!, CursorInformation.cursorPosition, new Point(20, 20), RelativePosition.BottomRight, 10);
        CursorPopupManager.open("testB1", Hello World!, CursorInformation.cursorPosition, new Point(20, 85), RelativePosition.Bottom, 10);
        CursorPopupManager.open("testBL1", Hello World!, CursorInformation.cursorPosition, new Point(20, 20), RelativePosition.BottomLeft, 10);
        CursorPopupManager.open("testL1", Hello World!, CursorInformation.cursorPosition, new Point(40, 20), RelativePosition.Left, 10);
        CursorPopupManager.open("testTL1", Hello World!, CursorInformation.cursorPosition, new Point(20, 20), RelativePosition.TopLeft, 10);
        CursorPopupManager.open("testT1", Hello World!, CursorInformation.cursorPosition, new Point(20, 100), RelativePosition.Top, 10);
      },
    });
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / CursorInformation.ts View on Github external
public static getRelativePositionFromCursorDirection(cursorDirection: CursorDirection): RelativePosition {
    let relativePosition: RelativePosition = RelativePosition.BottomRight;

    switch (cursorDirection) {
      case CursorDirection.Top:
        relativePosition = RelativePosition.Top;
        break;
      case CursorDirection.Left:
        relativePosition = RelativePosition.Left;
        break;
      case CursorDirection.Right:
        relativePosition = RelativePosition.Right;
        break;
      case CursorDirection.Bottom:
        relativePosition = RelativePosition.Bottom;
        break;
      case CursorDirection.TopLeft:
        relativePosition = RelativePosition.TopLeft;
        break;
      case CursorDirection.TopRight:
        relativePosition = RelativePosition.TopRight;
        break;
      case CursorDirection.BottomLeft:
        relativePosition = RelativePosition.BottomLeft;
        break;
      case CursorDirection.BottomRight:
        relativePosition = RelativePosition.BottomRight;
        break;
    }

    return relativePosition;
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopup.tsx View on Github external
popupRect.top = popupRect.bottom - popupSize.height;
        popupRect.right = popupRect.left + popupSize.width;
        break;
      case RelativePosition.Left:
        popupRect.right = pt.x - offset.x;
        popupRect.top = pt.y - (popupSize.height / 2);
        popupRect.left = popupRect.right - popupSize.width;
        popupRect.bottom = popupRect.top + popupSize.height;
        break;
      case RelativePosition.Right:
        popupRect.left = pt.x + offset.x;
        popupRect.top = pt.y - (popupSize.height / 2);
        popupRect.right = popupRect.left + popupSize.width;
        popupRect.bottom = popupRect.top + popupSize.height;
        break;
      case RelativePosition.Bottom:
        popupRect.top = pt.y + offset.y;
        popupRect.left = pt.x - (popupSize.width / 2);
        popupRect.bottom = popupRect.top + popupSize.height;
        popupRect.right = popupRect.left + popupSize.width;
        break;
      case RelativePosition.TopLeft:
        popupRect.bottom = pt.y - offset.y;
        popupRect.right = pt.x - offset.x;
        popupRect.top = popupRect.bottom - popupSize.height;
        popupRect.left = popupRect.right - popupSize.width;
        break;
      case RelativePosition.TopRight:
        popupRect.bottom = pt.y - offset.y;
        popupRect.left = pt.x + offset.x;
        popupRect.top = popupRect.bottom - popupSize.height;
        popupRect.right = popupRect.left + popupSize.width;
github imodeljs / imodeljs / ui / framework / src / ui-framework / messages / Pointer.tsx View on Github external
const adjustmentOffset = 20;
    let offset: PointProps | undefined;
    switch (this._relativePosition) {
      case RelativePosition.Top:
        offset = { x: 0, y: -adjustmentOffset };
        break;
      case RelativePosition.TopRight:
        offset = { x: adjustmentOffset, y: -adjustmentOffset };
        break;
      case RelativePosition.Right:
        offset = { x: adjustmentOffset, y: 0 };
        break;
      case RelativePosition.BottomRight:
        offset = { x: adjustmentOffset, y: adjustmentOffset };
        break;
      case RelativePosition.Bottom:
        offset = { x: 0, y: adjustmentOffset };
        break;
      case RelativePosition.BottomLeft:
        offset = { x: -adjustmentOffset, y: adjustmentOffset };
        break;
      case RelativePosition.Left:
        offset = { x: -adjustmentOffset, y: 0 };
        break;
      case RelativePosition.TopLeft:
        offset = { x: -adjustmentOffset, y: -adjustmentOffset };
        break;
    }

    this.setState((prevState) => {
      if (!this._viewport)
        return null;
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
case RelativePosition.Right:
        case RelativePosition.BottomRight:
          outPos = RelativePosition.TopRight;
          break;
      }
    }

    if (rect.top < 0) {
      flipped = true;
      switch (inPos) {
        case RelativePosition.Left:
        case RelativePosition.TopLeft:
          outPos = RelativePosition.BottomLeft;
          break;
        case RelativePosition.Top:
          outPos = RelativePosition.Bottom;
          break;
        case RelativePosition.Right:
        case RelativePosition.TopRight:
          outPos = RelativePosition.BottomRight;
          break;
      }
    }

    return { outPos, flipped };
  }
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
private getDimension(popupSize: Size, relativePosition: RelativePosition): number {
    let dimension = 0;

    switch (relativePosition) {
      case RelativePosition.Top:
      case RelativePosition.Bottom:
      case RelativePosition.TopLeft:
      case RelativePosition.TopRight:
      case RelativePosition.BottomLeft:
      case RelativePosition.BottomRight:
        dimension = popupSize.height;
        break;
      case RelativePosition.Left:
      case RelativePosition.Right:
        dimension = popupSize.width;
        break;
    }

    return dimension;
  }
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
private renderRelativePosition(relativePosition: RelativePosition): React.ReactNode {
    const filteredInfo = CursorPopupManager.popups.filter((popupInfo: CursorPopupInfo) => popupInfo.renderRelativePosition === relativePosition);

    if (filteredInfo.length > 0) {
      let totalDimension = 0;
      const ascending =
        relativePosition === RelativePosition.Right ||
        relativePosition === RelativePosition.BottomRight ||
        relativePosition === RelativePosition.Bottom ||
        relativePosition === RelativePosition.BottomLeft;

      const positionPopups = filteredInfo
        .sort((a: CursorPopupInfo, b: CursorPopupInfo): number => ascending ? a.priority - b.priority : b.priority - a.priority)
        .map((popupInfo: CursorPopupInfo, index: number) => {

          const title = (popupInfo.options !== undefined) ? popupInfo.options.title : "";
          const shadow = (popupInfo.options !== undefined) ? popupInfo.options.shadow : false;
          let offset = popupInfo.offset;

          if (index > 0)
            offset = this.adjustOffset(offset, popupInfo.renderRelativePosition, totalDimension);

          if (popupInfo.popupSize)
            totalDimension += this.getDimension(popupInfo.popupSize, relativePosition);
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
private static autoFlip(inPos: RelativePosition, rect: RectangleProps, windowWidth: number, windowHeight: number): { outPos: RelativePosition, flipped: boolean } {
    let flipped = false;
    let outPos = inPos;

    if (rect.right > windowWidth) {
      flipped = true;
      switch (inPos) {
        case RelativePosition.Top:
        case RelativePosition.TopRight:
          outPos = RelativePosition.TopLeft;
          break;
        case RelativePosition.Right:
          outPos = RelativePosition.Left;
          break;
        case RelativePosition.Bottom:
        case RelativePosition.BottomRight:
          outPos = RelativePosition.BottomLeft;
          break;
      }
    }

    if (rect.left < 0) {
      flipped = true;
      switch (inPos) {
        case RelativePosition.Top:
        case RelativePosition.TopLeft:
          outPos = RelativePosition.TopRight;
          break;
        case RelativePosition.Left:
          outPos = RelativePosition.Right;
          break;