mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-16 05:23:19 +01:00
41 lines
831 B
JavaScript
41 lines
831 B
JavaScript
import {BsTextareaT} from "react-icons/all";
|
|
import {Label} from "sketcher/shapes/label";
|
|
|
|
export default [
|
|
|
|
{
|
|
id: 'AddObjectLabel',
|
|
shortName: 'Add Label',
|
|
kind: 'Misc',
|
|
description: 'Add Label',
|
|
icon: BsTextareaT,
|
|
selectionMatcher: {
|
|
selector: 'function',
|
|
match: (selection) => true
|
|
},
|
|
invoke: (ctx, params) => {
|
|
const selection = ctx.viewer.selected;
|
|
ctx.ui.$wizardRequest.next({
|
|
title: "Label Text",
|
|
schema: [
|
|
{
|
|
name: 'text',
|
|
label: 'Label Text',
|
|
type: 'string'
|
|
}
|
|
],
|
|
onApply: (params) => {
|
|
selection.forEach(obj => {
|
|
const label = new Label(params.text, obj);
|
|
ctx.viewer.labelLayer.add(label);
|
|
});
|
|
}
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|