@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
55 lines • 2.33 kB
JavaScript
import { DThemes, EShapeButton, EShapeType } from "@wcardinal/wcardinal-ui";
import { EShapeExtensions } from "../e-shape-extensions";
import { EEditorShapeButton } from "./e-editor-shape-button";
var EShapeButtons = /** @class */ (function () {
function EShapeButtons() {
}
EShapeButtons.getTheme = function () {
return DThemes.get("EShapeButton");
};
EShapeButtons.create = function (existing) {
var result = new EShapeButton();
if (existing) {
result.copy(existing);
}
else {
var label = this.getTheme().getLabel();
result.stroke.set(false, 0x3399ff, 1);
result.fill.set(true, 0x3399ff, 1);
result.text.set(label, 0xffffff, 1);
result.cursor = "pointer";
result.state.isFocusable = true;
result.interactive = true;
}
return result;
};
EShapeButtons.load = function () {
var theme = this.getTheme();
var name = theme.getName();
EShapeExtensions.add({
type: EShapeType.BUTTON,
name: name,
icon: {
width: 24,
height: 24,
// Material Icons https://material.io/tools/icons/
// Available under Apache license version 2.0
svg: "<g transform=\"scale(26.6666)\" fill=\"#fff\" stroke=\"none\">" +
"<path d=\"M22,9v6c0,1.1-0.9,2-2,2h-1l0-2h1V9H4v6h6v2H4c-1.1,0-2" +
"-0.9-2-2V9c0-1.1,0.9-2,2-2h16C21.1,7,22,7.9,22,9z M14.5,19 l1." +
"09-2.41L18,15.5l-2.41-1.09L14.5,12l-1.09,2.41L11,15.5l2.41,1.0" +
"9L14.5,19z M17,14l0.62-1.38L19,12l-1.38-0.62L17,10l-0.62,1.38 " +
"L15,12l1.38,0.62L17,14z M14.5,19l1.09-2.41L18,15.5l-2.41-1.09L" +
"14.5,12l-1.09,2.41L11,15.5l2.41,1.09L14.5,19z M17,14l0.62-1.38" +
" L19,12l-1.38-0.62L17,10l-0.62,1.38L15,12l1.38,0.62L17,14z\"/>" +
"</g>"
},
title: name,
creator: function (existing) { return EShapeButtons.create(existing); },
editor: EEditorShapeButton
});
};
return EShapeButtons;
}());
export { EShapeButtons };
//# sourceMappingURL=e-shape-buttons.js.map