How to use the @bentley/ui-abstract.RelativePosition.Top 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
private _handleTool4Keypress = (event: any) => {
    const details = new NotifyMessageDetails(OutputMessagePriority.Info, "", this._tool4Detailed);
    let changed = false;

    switch (event.keyCode) {
      case 37:
        details.briefMessage = "Left pressed";
        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;
    }
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 / cursorpopup / CursorPopupManager.tsx View on Github external
private adjustOffset(offset: Point, relativePosition: RelativePosition, dimension: number): Point {
    let outOffset = Point.create(offset.toProps());

    switch (relativePosition) {
      case RelativePosition.Top:
      case RelativePosition.Bottom:
      case RelativePosition.TopLeft:
      case RelativePosition.TopRight:
      case RelativePosition.BottomLeft:
      case RelativePosition.BottomRight:
        outOffset = Point.create({ x: offset.x, y: offset.y + dimension });
        break;
      case RelativePosition.Left:
      case RelativePosition.Right:
        outOffset = Point.create({ x: offset.x + dimension, y: offset.y });
        break;
    }

    return outOffset;
  }
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
case RelativePosition.Bottom:
        case RelativePosition.BottomLeft:
          outPos = RelativePosition.BottomRight;
          break;
      }
    }

    if (rect.bottom > windowHeight) {
      flipped = true;
      switch (inPos) {
        case RelativePosition.Left:
        case RelativePosition.BottomLeft:
          outPos = RelativePosition.TopLeft;
          break;
        case RelativePosition.Bottom:
          outPos = RelativePosition.Top;
          break;
        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:
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
break;
        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 / messages / Pointer.tsx View on Github external
private updatePosition() {
    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 };
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;
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopup.tsx View on Github external
public static getPopupRect(pt: PointProps, offset: PointProps, popupSize: SizeProps | undefined, relativePosition: RelativePosition): RectangleProps {
    const popupRect = { top: 0, left: 0, right: 0, bottom: 0 };

    if (popupSize === undefined)
      return popupRect;

    switch (relativePosition) {
      case RelativePosition.Top:
        popupRect.bottom = pt.y - offset.y;
        popupRect.left = pt.x - (popupSize.width / 2);
        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;
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) {