How to use the @bentley/ui-abstract.RelativePosition.TopRight 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
iconSpec: "icon-placeholder", labelKey: "SampleApp:buttons.startCursorPopup", execute: async () => {
        // const relativePosition = CursorInformation.getRelativePositionFromCursorDirection(CursorInformation.cursorDirection);
        const content = (
          
            {FrontstageManager.activeToolSettingsNode}
          
        );
        // CursorPopupManager.open("test1", content, CursorInformation.cursorPosition, new Point(20, 20), RelativePosition.TopRight, 10);
        CursorPopupManager.open("test1", content, CursorInformation.cursorPosition, new Point(20, 20), RelativePosition.TopRight, 10);
        CursorInformation.onCursorUpdatedEvent.addListener(this._handleCursorUpdated);
        document.addEventListener("keyup", this._handleCursorPopupKeypress);
      },
    });
github imodeljs / imodeljs / core / frontend / src / NotificationManager.ts View on Github external
  public updatePointerMessage(_displayPoint: XAndY, _relativePosition = RelativePosition.TopRight): void { }
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopup.tsx View on Github external
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;
        break;
      case RelativePosition.BottomLeft:
        popupRect.top = pt.y + offset.y;
        popupRect.right = pt.x - offset.x;
        popupRect.bottom = popupRect.top + popupSize.height;
        popupRect.left = popupRect.right - popupSize.width;
        break;
      case RelativePosition.BottomRight:
        popupRect.top = pt.y + offset.y;
        popupRect.left = pt.x + offset.x;
        popupRect.bottom = popupRect.top + popupSize.height;
        popupRect.right = popupRect.left + popupSize.width;
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 };
        break;
      case RelativePosition.Left:
        offset = { x: -adjustmentOffset, y: 0 };
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:
github imodeljs / imodeljs / core / frontend / src / NotificationManager.ts View on Github external
* @public
 */
export interface ToolTipOptions {
  duration?: BeDuration;
  placement?: string;
}

/** Describes a message to be displayed to the user.
 * @public
 */
export class NotifyMessageDetails {
  public displayTime = BeDuration.fromSeconds(3.5);
  public viewport?: HTMLElement;
  public inputField?: HTMLElement;
  public displayPoint?: Point2d;
  public relativePosition = RelativePosition.TopRight;

  /** Constructor
   *  @param priority        The priority this message should be accorded by the NotificationManager.
   *  @param briefMsg        A short message that conveys the simplest explanation of the issue.
   *  @param detailedMsg     A comprehensive message that explains the issue in detail and potentially offers a solution.
   *  @param msgType         The type of message.
   *  @param openAlert       Whether an alert box should be displayed or not, and if so what kind.
   */
  public constructor(public priority: OutputMessagePriority, public briefMessage: HTMLElement | string,
    public detailedMessage?: HTMLElement | string, public msgType = OutputMessageType.Toast, public openAlert = OutputMessageAlert.None) { }

  /** Set OutputMessageType.Pointer message details.
   * @param viewport            Viewport over which to display the Pointer type message.
   * @param displayPoint        Point at which to display the Pointer type message.
   * @param relativePosition    Position relative to displayPoint at which to display the Pointer type message.
   */
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.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;
        case RelativePosition.Bottom:
        case RelativePosition.BottomLeft:
          outPos = RelativePosition.BottomRight;
          break;
      }
    }

    if (rect.bottom > windowHeight) {
      flipped = true;
      switch (inPos) {
        case RelativePosition.Left:
        case RelativePosition.BottomLeft:
github imodeljs / imodeljs / ui / framework / src / ui-framework / cursor / cursorpopup / CursorPopupManager.tsx View on Github external
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
}
    }

    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:
          outPos = RelativePosition.Bottom;
          break;
        case RelativePosition.Right:
        case RelativePosition.TopRight: