|
@@ -6,6 +6,7 @@ import {
|
|
|
} from "../../board";
|
|
|
import { Label, Tag } from "konva/lib/shapes/Label";
|
|
|
import { Text } from "konva/lib/shapes/Text";
|
|
|
+import { Group } from "konva/lib/Group";
|
|
|
|
|
|
export const svgs = {
|
|
|
wljg: [
|
|
@@ -204,24 +205,53 @@ export const svgs = {
|
|
|
SingleBed: [
|
|
|
`M800 96H224v832h576V96zM256 288V128h512v160h-96V240A80 80 0 0 0 592 160h-160A80 80 0 0 0 352 240V288H256z m128 0V240A48 48 0 0 1 432 192h160A48 48 0 0 1 640 240V288h-256z m-128 32h512v64H256v-64z m0 576V416h512v480H256z`,
|
|
|
],
|
|
|
+ Tag: [],
|
|
|
};
|
|
|
|
|
|
for (const key in svgs) {
|
|
|
injectPoiType(key, (attrib, tree) => {
|
|
|
- const svgAct = pathsToActShape(
|
|
|
- {
|
|
|
- paths: svgs[key],
|
|
|
- size: [1000, 800],
|
|
|
- realWidth: 0.8,
|
|
|
- offset: [0, 100],
|
|
|
- strokeWidth: 5,
|
|
|
- fixed: false,
|
|
|
- strokeColor: "#FFFFFF",
|
|
|
- },
|
|
|
- false
|
|
|
- );
|
|
|
-
|
|
|
- const paths = svgAct.shape.find<Path>(".path");
|
|
|
+ console.error(attrib);
|
|
|
+ let svgAct: ReturnType<typeof pathsToActShape>;
|
|
|
+ if (key === "Tag") {
|
|
|
+ const simpleText = new Text({
|
|
|
+ name: "rect",
|
|
|
+ text: attrib.text || "文本",
|
|
|
+ fontSize: 0.2,
|
|
|
+ fontFamily: "Calibri",
|
|
|
+ });
|
|
|
+ simpleText.offsetX(simpleText.width() / 2);
|
|
|
+ simpleText.offsetY(simpleText.height() / 2);
|
|
|
+ const group = new Group();
|
|
|
+ group.add(simpleText);
|
|
|
+ svgAct = {
|
|
|
+ shape: group,
|
|
|
+ getSize() {
|
|
|
+ return [simpleText.width(), simpleText.height()];
|
|
|
+ },
|
|
|
+ setData(data) {
|
|
|
+ group.position(data);
|
|
|
+ group.rotation(data.rotate || 0);
|
|
|
+ simpleText.text(data.text || "文本");
|
|
|
+ },
|
|
|
+ common() {
|
|
|
+ simpleText.fill("#ffffff");
|
|
|
+ },
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ svgAct = pathsToActShape(
|
|
|
+ {
|
|
|
+ paths: svgs[key],
|
|
|
+ size: [1000, 800],
|
|
|
+ realWidth: 0.8,
|
|
|
+ offset: [0, 100],
|
|
|
+ strokeWidth: 5,
|
|
|
+ fixed: false,
|
|
|
+ strokeColor: "#FFFFFF",
|
|
|
+ },
|
|
|
+ false
|
|
|
+ );
|
|
|
+ }
|
|
|
+ const paths = svgAct.shape.find<Path>(key === "Tag" ? ".rect" : ".path");
|
|
|
|
|
|
const label = new Label({ opacity: 0.75, name: "label" });
|
|
|
label.add(
|