@itwin/core-frontend
Version:
iTwin.js frontend components
219 lines • 10.7 kB
TypeScript
import { AccuDraw, ItemField } from "../AccuDraw";
import { ViewRect } from "../common/ViewRect";
import { BeButtonEvent } from "./Tool";
import { ScreenViewport } from "../Viewport";
/** Provides an in viewport user interface for AccuDraw that can optionally follow the cursor or remain at a fixed location.
* @beta
*/
export declare class AccuDrawViewportUI extends AccuDraw {
private _focusItem;
private _controls?;
private _toolTipsSuspended?;
private _expression?;
/** Settings to control the behavior and visual appearance of the viewport controls.
* @note Colors were chosen for visibility against viewport background and contents.
*/
static controlProps: {
/** Suspend locate tooltip when controls are shown, may wish to disable when using fixed location. */
suspendLocateToolTip: boolean;
/** Show controls at a fixed location in the view (currently bottom middle) instead of following the cursor. */
fixedLocation: boolean;
/** Layout controls in a single row horizontally instead of in columns vertically as an option when using fixed location. */
horizontalArrangement: boolean;
/** When controls follow the cursor, the X and Y offsets applied to the current point to position the top left (values in inches based on screen DPI) */
cursorOffset: {
x: number;
y: number;
};
/** Replace "^", ";", and ".." with "°" or ":" for easier input. */
simplifiedInput: boolean;
/** Enable simple math operations not supported by quantity parser. */
mathOperations: boolean;
/** Settings that apply to both text input fields and lock buttons. */
field: {
/** Number of visible characters to show in text input fields. */
size: number;
/** Height of text input fields and lock buttons. */
height: string;
/** Border settings for text input fields and lock buttons. */
border: {
/** Border width to use for text input fields and lock buttons. */
width: string;
/** Border style to use for text input fields and lock buttons. */
style: string;
/** Corner radius of text input fields and locks buttons. */
radius: string;
};
/** Settings specific to text input fields and lock button labels. */
text: {
/** Font family to use for text input field values and button labels. */
fontFamily: string;
/** Font size to use for text input field values and button labels. */
fontSize: string;
};
};
/** Settings specific to text input fields. */
input: {
/** Font color to use for text input field values. */
color: string;
/** Padding applied to text input fields. */
padding: string;
/** Settings applied to text input fields when they have focus. */
focused: {
/** Background color for focused text input fields. */
backgroundColor: string;
/** Inner stroke for focused text input fields. */
innerStroke: string;
/** Border settings for focused text input fields. */
border: {
/** Border color for focused text input fields. */
color: string;
};
};
/** Settings applied to text input fields when they do not have focus. */
unfocused: {
/** Background color for unfocused text input fields. */
backgroundColor: string;
/** Border settings for unfocused text input fields. */
border: {
/** Border color for unfocused text input fields. */
color: string;
};
};
};
/** Settings specific to lock buttons. */
button: {
/** Padding applied to lock buttons. */
padding: string;
/** Settings applied to lock buttons when they are unlocked. */
unlocked: {
/** Text color for unlocked lock buttons. */
color: string;
/** Background color for unlocked lock buttons. */
backgroundColor: string;
/** Border settings for unlocked lock buttons. */
border: {
/** Border color for unlocked lock buttons. */
color: string;
};
};
/** Settings applied to lock buttons when they are locked. */
locked: {
/** Text color for locked lock buttons. */
color: string;
/** Background color for locked lock buttons. */
backgroundColor: string;
/** Border settings for locked lock buttons. */
border: {
/** Border color for locked lock buttons. */
color: string;
};
};
};
/** Spacing between fields within a control and between rows of controls. */
spacing: {
/** Spacing between input field and lock button within each field group. */
gap: string;
/** Spacing between field groups (distance/angle, x, y, z controls). */
margin: string;
};
};
/** Create a new instance of this class to set as [[IModelAppOptions.accuDraw]] for this session. */
constructor();
/** Call to set a vertical layout that follows the cursor. This is the default configuration. */
setVerticalCursorLayout(): void;
/** Call to set a horizontal layout that is anchored to the bottom middle of the view. */
setHorizontalFixedLayout(): void;
/** Call to update the currently displayed controls after settings are changed. */
refreshControls(): void;
private suspendToolTips;
private unsuspendToolTips;
private setDynamicKeyinStatus;
private setPartialKeyinStatus;
private evaluateExpression;
private parseExpression;
private processPartialInput;
private acceptPartialInput;
private acceptSavedValue;
private doFocusHome;
private doChooseSavedValue;
private doNavigate;
private doAcceptInput;
private doNewInput;
private doDeleteInput;
private processReplacementKey;
private processRepeatedKey;
private doProcessOverrideKey;
private doProcessExpressionKey;
private doProcessKey;
private onKeyboardEvent;
private removeControls;
private createControlDiv;
private updateItemFieldKeyinStatus;
private updateItemFieldValue;
private updateItemFieldLock;
private initializeItemStyle;
private createItemField;
private createItemFieldLock;
/** Called after the controls have been removed from the view. */
protected removedControlRect(): void;
/** Called after the position of the controls in the supplied view is updated. */
protected changedControlRect(_rect: ViewRect, _vp: ScreenViewport): void;
/** Use to override the position of the controls in the supplied view. */
protected modifyControlRect(_rect: ViewRect, _vp: ScreenViewport): void;
/** Return the ViewRect currently occupied by the controls in the supplied view. */
protected currentControlRect(vp: ScreenViewport): ViewRect | undefined;
private updateControlVisibility;
private updateControls;
private get _isFocusHome();
private get _isFocusAccuDraw();
private setFocusHome;
/** Return whether keyboard shortcuts can or can't be used.
* Used to show a visual indication of whether keyboard shortcuts will be processed.
* Keyboard shortcuts can be supported when focus is either on AccuDraw or Home.
* When returning false the compass displays in monochrome.
*/
get hasInputFocus(): boolean;
/** Get the item field that currently has input focus.
*/
getFocusItem(): ItemField | undefined;
/** Request to set focus to the specified AccuDraw input field to start entering values.
* The focused input field will be indicated by the background color.
*/
setFocusItem(index: ItemField): void;
/** Request to set focus to the active AccuDraw input field to start entering values.
* The focused input field will be indicated by the background color.
*/
grabInputFocus(): void;
private onFocusChange;
/** Change notification for when the compass is shown or hidden.
* Used to hide the viewport controls when the compass is no longer displayed.
*/
onCompassDisplayChange(state: "show" | "hide"): void;
/** Change notification for when the compass mode switches between polar and rectangular inputs.
* Used to show or hide the input fields that are applicable to the current mode.
*/
onCompassModeChange(): void;
/** Change notification for when the supplied input field switches between dynamic and partial input.
* When an input field is in the dynamic state, its value changes according to the current button event unless the field is locked.
* When an input field is in the partial state, its value is not changed or formatted to allow the value to be changed.
* Locking a field is expected to change the input state to partial.
* Unlocking a field or accepting a value by focusing is expected to change the input state to dynamic.
*/
onFieldKeyinStatusChange(item: ItemField): void;
/** Change notification for when the supplied input field value has been modified.
* Used to update the displayed input field with the value from the active angle or distance formatter.
*/
onFieldValueChange(item: ItemField): void;
/** Change notification for when the supplied input field lock status is modified.
* Used to update the displayed lock toggles to reflect the current state.
*/
onFieldLockChange(item: ItemField): void;
/** Change notification of a motion event in the view.
* Used to show as well as update the dynamic input field values to reflect the current deltas when active.
* Automatically switches the focused input field between x and y in rectangular mode based on
* cursor position when axis isn't locked to support more intuitive user input and "smart lock" keyboard shortcut.
*/
onMotion(ev: BeButtonEvent): void;
}
//# sourceMappingURL=AccuDrawViewportUI.d.ts.map