Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
},
});
public updatePointerMessage(_displayPoint: XAndY, _relativePosition = RelativePosition.TopRight): void { }
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;
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 };
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:
* @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.
*/
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;
}
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:
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 };
}
}
}
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: