Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._measureNamespace!.readFinished.then(() => {
// restart the tool.
console.log("MeasurePoints onExecute called, args", args);
IModelApp.tools.run("Measure.Points");
})
.catch((err) => { console.log(err); });
public static executeCommand = () => {
// first load the plugin
IModelApp.tools.run("Plugin", ["MeasurePoints.js"]);
}
public static async initialize(): Promise {
if (undefined === this.namespace) { // only need to do this once
this.namespace = IModelApp.i18n.registerNamespace("MarkupTools");
IModelApp.tools.register(SelectTool, this.namespace);
IModelApp.tools.registerModule(redlineTool, this.namespace);
IModelApp.tools.registerModule(textTool, this.namespace);
}
return this.namespace.readFinished; // so caller can make sure localized messages are ready.
}
private _processInputValue(inputValue: string): boolean {
let currentKeyin = "";
let foundTool: typeof Tool | undefined;
if (this.state.currentToolId && this.state.currentToolId.length > 0) {
foundTool = IModelApp.tools.find(this.state.currentToolId);
// istanbul ignore else
if (foundTool)
currentKeyin = foundTool.keyin;
}
// istanbul ignore next
if (inputValue !== currentKeyin) {
const inputValueLower = inputValue.trim().toLowerCase();
foundTool = IModelApp.tools.getToolList()
.find((tool: typeof Tool) => tool.keyin.toLowerCase() === inputValueLower || tool.englishKeyin.toLowerCase() === inputValueLower);
if (!foundTool) {
this._outputMessage(UiFramework.translate("keyinbrowser.couldNotFindTool"));
return false;
} else {
const currentToolId = foundTool.toolId;
// istanbul ignore else
if (this._isMounted)
this.setState({ currentToolId });
}
}
return true;
}
private _execute = () => {
if (this.props.execute) {
this.props.execute();
} else {
const thisTool: typeof Tool | undefined = IModelApp.tools.find(this.props.toolId);
// istanbul ignore else
if (thisTool)
(new thisTool()).run();
}
}
handler: () => { IModelApp.tools.run(this._toolName, ViewClipDecorationProvider.create()); setFocusToHome(); },
parent: div,
click: () => IModelApp.tools.run("SVTSelect"),
tooltip: "Element selection",
click: () => IModelApp.tools.run("View.Standard", IModelApp.viewManager.selectedView, i),
}));
handler: () => IModelApp.tools.run("ViewClip.Clear", ViewClipDecorationProvider.create()),
parent: div,
const handleClear = () => {
IModelApp.tools.run(ViewClipClearTool.toolId, ViewClipDecorationProvider.create());
setPopupOpen(false);
};