Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// console.log(`Requesting tools for toolbar ${toolBarId}`);
if ("[ViewsFrontstage]ToolWidget-horizontal" === toolBarId) {
const simpleActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "simple-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "simple-test-action-tool",
};
const childActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "child-test-action-tool",
condition: {
type: ConditionalDisplayType.Visibility,
testFunc: (): boolean => SampleAppIModelApp.getTestProperty() !== "HIDE",
syncEventIds: [SampleAppUiActionId.setTestProperty],
},
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "child-test-action-tool",
};
const nestedActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
} else if ("[ViewsFrontstage]NavigationWidget-horizontal" === toolBarId) {
const navHorizontalSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "nav1-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "test action tool (navH)",
};
return [navHorizontalSpec];
} else if ("[ViewsFrontstage]NavigationWidget-vertical" === toolBarId) {
const navVerticalSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "nav2-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "test action tool (navV)",
};
return [navVerticalSpec];
}
return [];
}
}
const nestedActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
parentToolGroupId: "tool-formatting-setting",
itemId: "nested-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "test action tool (nested)",
};
const groupSpec: GroupItemInsertSpec = {
itemType: ToolbarItemType.GroupButton,
itemId: "test-tool-group",
badge: BadgeType.TechnicalPreview,
icon: "icon-developer",
label: "test group",
items: [childActionSpec, simpleActionSpec],
};
return [simpleActionSpec, nestedActionSpec, groupSpec];
} else if ("[ViewsFrontstage]NavigationWidget-horizontal" === toolBarId) {
const navHorizontalSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "nav1-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
};
const nestedActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
parentToolGroupId: "tool-formatting-setting",
itemId: "nested-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "test action tool (nested)",
};
const groupSpec: GroupItemInsertSpec = {
itemType: ToolbarItemType.GroupButton,
itemId: "test-tool-group",
badge: BadgeType.TechnicalPreview,
icon: "icon-developer",
label: "test group",
items: [childActionSpec, simpleActionSpec],
};
return [simpleActionSpec, nestedActionSpec, groupSpec];
} else if ("[ViewsFrontstage]NavigationWidget-horizontal" === toolBarId) {
const navHorizontalSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "nav1-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
const simpleActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "simple-test-action-tool",
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "simple-test-action-tool",
};
const childActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
itemId: "child-test-action-tool",
condition: {
type: ConditionalDisplayType.Visibility,
testFunc: (): boolean => SampleAppIModelApp.getTestProperty() !== "HIDE",
syncEventIds: [SampleAppUiActionId.setTestProperty],
},
execute: (): void => {
// tslint:disable-next-line: no-console
console.log("Got Here!");
},
icon: "icon-developer",
label: "child-test-action-tool",
};
const nestedActionSpec: ActionItemInsertSpec = {
itemType: ToolbarItemType.ActionButton,
parentToolGroupId: "tool-formatting-setting",
itemId: "nested-test-action-tool",
execute: (): void => {
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);
},
});
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;
}
if (changed) {
IModelApp.notifications.outputMessage(details);
IModelApp.notifications.updatePointerMessage({ x: CursorInformation.cursorX, y: CursorInformation.cursorY }, this._toolRelativePosition);
}
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);
}
}
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;
}
),
});
}
// cSpell:enable
public additionalHorizontalToolbarItems = new ItemList([
this._openNestedAnimationStage,
CoreTools.keyinBrowserButtonItemDef,
AppTools.tool1,
new ConditionalItemDef({
conditionalId: "Conditional-tool-2",
items: [AppTools.tool2, this._viewportPopupButtonItemDef],
stateSyncIds: [SampleAppUiActionId.setTestProperty],
stateFunc: this._enabledTestStateFunc,
badgeType: BadgeType.New,
}),
AppTools.toolWithSettings,
AppTools.toggleHideShowItemsCommand,
new ConditionalItemDef({
conditionalId: "Conditional-formatting",
items: [
new GroupItemDef({
groupId: "tool-formatting-setting",
labelKey: "SampleApp:buttons.toolGroup",
iconSpec: "icon-placeholder",
items: [AppTools.setLengthFormatMetricCommand, AppTools.setLengthFormatImperialCommand, AppTools.toggleLengthFormatCommand, CoreTools.clearSelectionItemDef],
itemsInColumn: 4,
}),
],
stateSyncIds: [SampleAppUiActionId.setTestProperty],
stateFunc: this._visibleTestStateFunc,