Просмотр исходного кода

feat: 制表模块增加真实单位

bill 8 часов назад
Родитель
Сommit
2d197cd310

+ 2 - 1
src/core/components/arrow/index.ts

@@ -26,7 +26,7 @@ export const defaultStyle = {
 // export const fill
 
 export const addMode = "area";
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 
 export const getMouseStyle = (data: ArrowData) => {
   const strokeStatus = getMouseColors(data.fill || defaultStyle.fill);
@@ -84,6 +84,7 @@ export const interactiveToData: InteractiveTo<"arrow"> = ({
 };
 
 export const interactiveFixData: InteractiveFix<"arrow"> = ({ data, info }) => {
+  console.log(data)
   // const nv = [...info.consumed, info.cur!];
   // data.points.length = nv.length
   // for (let i = 0; i < nv.length; i++) {

+ 1 - 1
src/core/components/circle/index.ts

@@ -28,7 +28,7 @@ export const defaultStyle = {
 };
 
 export const addMode = "area";
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 
 export const getMouseStyle = (data: CircleData) => {
   const fillStatus = data.fill && getMouseColors(data.fill);

+ 1 - 1
src/core/components/icon/icon.ts

@@ -20,7 +20,7 @@ export const defaultStyle = {
   width: 80,
   height: 80,
 };
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 
 type ColorCounts = [string, number][];
 const colorsManage = (counts: ColorCounts, color: any) => {

+ 1 - 1
src/core/components/line-chunk/index.ts

@@ -18,7 +18,7 @@ export const defaultStyle = {
   dash: [30, 0],
 };
 
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 export const useDraw = generateUseDraw('lineChunk');
 
 export const getMouseStyle = (data: LineData) => {

+ 1 - 1
src/core/components/line-icon/index.ts

@@ -22,7 +22,7 @@ import { DrawStore } from "@/core/store/index.ts";
 export { defaultStyle, addMode, TempComponent, Component };
 export { getMouseStyle, getPredefine } from "../icon/index.ts";
 
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 
 export const shapeName = "线段图例";
 export type LineIconData = Omit<IconData, "mat" | "width"> & {

+ 1 - 1
src/core/components/polygon/index.ts

@@ -9,7 +9,7 @@ export { default as Component } from "./polygon.vue";
 export { default as TempComponent } from "./temp-polygon.vue";
 
 export const shapeName = "多边形";
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 export const defaultStyle = {
   stroke: "#000000",
   fixed: true,

+ 1 - 1
src/core/components/rectangle/index.ts

@@ -19,7 +19,7 @@ export const defaultStyle = {
   fontStyle: "normal",
   fontColor: "#000000",
 };
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 
 export const getMouseStyle = (data: RectangleData) => {
   const fillStatus = data.fill && getMouseColors(data.fill);

+ 3 - 3
src/core/components/serial/index.ts

@@ -36,6 +36,8 @@ export const defaultStyle = {
   strokeWidth: 2,
 };
 
+export const fixedStrokeOptions:number[] = [];
+
 export type SerialData = CircleData;
 
 export const getSerialFontW = (data: SerialData) => {
@@ -105,7 +107,7 @@ export const delItemRaw = (
   const ndx = data.indexOf(item);
   const getPosition = (itemNdx: number) => {
     const colCount = table.content[0].length / 2;
-    const rowNdx = 1 + Math.floor(itemNdx / colCount);
+    const rowNdx = Math.floor(itemNdx / colCount);
     const colNdx = itemNdx % colCount;
     return [rowNdx, colNdx * colCount, colCount] as const;
   };
@@ -213,7 +215,5 @@ export const matResponse = (
 export const getPredefine = (key: keyof CircleData) => {
   if (key === "fill") {
     return { canun: true };
-  } else if (key === "strokeWidth") {
-    return { proportion: true };
   }
 };

+ 56 - 32
src/core/components/serial/serial-group.vue

@@ -32,6 +32,35 @@ import {
 import { useConfig } from "@/core/hook/use-config";
 
 defineProps<{ type?: ShapeType }>();
+const getTempContents = () => {
+  const tempContents: TableCollData[] = [];
+  for (let i = 0; i < defaultTableStyle.repColCount; i++) {
+    tempContents.push(
+      {
+        key: "preset-col",
+        content: "序号",
+        readonly: true,
+        notdel: true,
+        width: defaultTableStyle.nameColWidth,
+        height: defaultTableStyle.colHeight,
+        fontSize: defaultTableStyle.fontSize,
+        padding: defaultTableStyle.padding,
+      },
+      {
+        key: "preset-col",
+        content: "描述",
+        readonly: true,
+        notdel: true,
+        width: defaultTableStyle.valueColWidth,
+        height: defaultTableStyle.colHeight,
+        fontSize: defaultTableStyle.fontSize,
+        padding: defaultTableStyle.padding,
+      }
+    );
+  }
+  return tempContents;
+};
+
 const store = useStore();
 const data = computed(() => store.getTypeItems("serial"));
 const history = useHistory();
@@ -75,32 +104,8 @@ const addTable = () => {
     y: pos.y + h,
   };
 
-  const content: TableCollData[] = [];
-  for (let i = 0; i < defaultTableStyle.repColCount; i++) {
-    content.push(
-      {
-        content: "序号",
-        readonly: true,
-        notdel: true,
-        width: defaultTableStyle.nameColWidth,
-        height: defaultTableStyle.colHeight,
-        key: "serial-name",
-        fontSize: defaultTableStyle.fontSize,
-        padding: defaultTableStyle.padding,
-      },
-      {
-        content: "描述",
-        readonly: true,
-        notdel: true,
-        width: defaultTableStyle.valueColWidth,
-        height: defaultTableStyle.colHeight,
-        fontSize: defaultTableStyle.fontSize,
-        key: "serial-value",
-        padding: defaultTableStyle.padding,
-      }
-    );
-  }
-
+  // const content: TableCollData[] = [];
+  const content: TableCollData[] = getTempContents();
   return tableInteractiveToData({
     info: { cur: [pos, end] },
     preset: {
@@ -108,6 +113,7 @@ const addTable = () => {
       notaddCol: true,
       key: joinKey,
       fontSize: defaultTableStyle.fontSize,
+      title: "图示",
       content: [content],
       strokeWidth: defaultTableStyle.tableStrokeWidth,
     },
@@ -118,6 +124,13 @@ const addTable = () => {
 };
 
 const syncTable = (table: TableData) => {
+  const tempRow = table.content[table.content.length - 1];
+  const presetIndex = table.content.findIndex((row) => row[0].key === "preset-col");
+  if (presetIndex !== -1) {
+    table.content.splice(presetIndex, 1);
+    table.height -= tempRow[0].height;
+  }
+
   const items = data.value;
   const cols = table.content.flatMap((row) => {
     const cols = [];
@@ -126,7 +139,6 @@ const syncTable = (table: TableData) => {
     }
     return cols;
   });
-  const tempRow = table.content[table.content.length - 1];
   const colCount = tempRow.length / 2;
 
   let isUpdate = false;
@@ -135,7 +147,7 @@ const syncTable = (table: TableData) => {
     if (cols.some((col) => col.content === item.content)) {
       continue;
     }
-    let rowNdx = Math.floor(i / colCount) + 1;
+    let rowNdx = Math.floor(i / colCount);
     let colNdx = (i % colCount) * 2;
     if (colNdx) {
       table.content[rowNdx][colNdx].content = item.content!;
@@ -143,13 +155,25 @@ const syncTable = (table: TableData) => {
     } else {
       table.height += tempRow[0].height;
       let cols = [
-        { ...tempRow[0], content: item.content! },
-        { ...tempRow[1], content: item.desc || "", readonly: false },
+        { ...tempRow[0], content: item.content!, hidden: false, key: "serial-name" },
+        {
+          ...tempRow[1],
+          content: item.desc || "",
+          readonly: false,
+          hidden: false,
+          key: "serial-desc",
+        },
       ];
       for (let i = 1; i < colCount; i++) {
         cols.push(
-          { ...tempRow[2], content: "" },
-          { ...tempRow[3], content: "", readonly: false }
+          { ...tempRow[2], content: "", hidden: false, key: "serial-name" },
+          {
+            ...tempRow[3],
+            content: "",
+            readonly: false,
+            hidden: false,
+            key: "serial-desc",
+          }
         );
       }
       table.content.push(cols);

+ 10 - 1
src/core/components/serial/serial.vue

@@ -16,7 +16,13 @@
 </template>
 
 <script lang="ts" setup>
-import { SerialData, getMouseStyle, defaultStyle, matResponse } from "./index.ts";
+import {
+  SerialData,
+  getMouseStyle,
+  defaultStyle,
+  matResponse,
+  fixedStrokeOptions,
+} from "./index.ts";
 import { PropertyUpdate, Operate } from "../../html-mount/propertys/index.ts";
 import { TempComponent } from "./";
 import { useComponentStatus } from "@/core/hook/use-component.ts";
@@ -24,6 +30,7 @@ import { Transform } from "konva/lib/Util";
 import { cloneRepShape, useCustomTransformer } from "@/core/hook/use-transformer.ts";
 import { Ellipse } from "konva/lib/shapes/Ellipse";
 import { Pos } from "@/utils/math.ts";
+import { useInstallStrokeWidthDescribe } from "@/core/hook/use-describe.ts";
 
 const props = defineProps<{ data: SerialData }>();
 const emit = defineEmits<{
@@ -91,4 +98,6 @@ const { shape, tData, data, operateMenus, describes } = useComponentStatus<
     // "ref", "zIndex"
   ],
 });
+
+useInstallStrokeWidthDescribe(describes, data, fixedStrokeOptions, undefined, true);
 </script>

+ 4 - 0
src/core/components/table/index.ts

@@ -22,6 +22,7 @@ export const defaultStyle = {
   fontSize: 16,
   align: "center",
   fontStyle: "normal",
+  titleHeight: 20,
   fontColor: '#000000',
 };
 export const defaultCollData = {
@@ -34,6 +35,8 @@ export const defaultCollData = {
 
 export const addMode = "area";
 
+export const fixedStrokeOptions:number[] = [];
+
 export type TableCollData = Partial<typeof defaultCollData> &
   Size & {
     content: string;
@@ -45,6 +48,7 @@ export type TableCollData = Partial<typeof defaultCollData> &
 export type TableData = Partial<typeof defaultStyle> &
   BaseItem &
   Size & {
+    title?: string;
     fill?: string | null
     notaddRow?: boolean;
     notaddCol?: boolean;

+ 4 - 0
src/core/components/table/table.vue

@@ -29,6 +29,7 @@ import {
   defaultStyle,
   matResponse,
   getColMinSize,
+  fixedStrokeOptions,
 } from "./index.ts";
 import { PropertyUpdate, Operate } from "../../html-mount/propertys/index.ts";
 import { useComponentStatus } from "@/core/hook/use-component.ts";
@@ -52,6 +53,7 @@ import {
 } from "@/core/hook/use-mouse-status.ts";
 import { useCursor, usePointerPos } from "@/core/hook/use-global-vars.ts";
 import { Pos } from "@/utils/math.ts";
+import { useInstallStrokeWidthDescribe } from "@/core/hook/use-describe.ts";
 
 const props = defineProps<{ data: TableData }>();
 const emit = defineEmits<{
@@ -387,4 +389,6 @@ const submitInputHandler = (playData: {
   data.value.content[playData.rowNdx][playData.colNdx].content = playData.val;
   emit("updateShape", data.value);
 };
+
+useInstallStrokeWidthDescribe(describes, data, fixedStrokeOptions);
 </script>

+ 24 - 0
src/core/components/table/temp-table.vue

@@ -10,6 +10,30 @@
       }"
     >
     </v-rect>
+    <v-rect
+      v-if="data.title"
+      :config="{
+        x: 0,
+        y: -data.titleHeight,
+        width: data.width,
+        height: data.titleHeight,
+        stroke: data.stroke,
+        strokeWidth: data.strokeWidth,
+      }"
+    />
+    <v-text
+      :config="{
+        x: 0,
+        y: -data.titleHeight,
+        width: data.width,
+        height: data.titleHeight,
+        text: data.title,
+        fontSize: data.fontSize,
+        align: data.align,
+        verticalAlign: 'middle',
+        fill: data.fontColor,
+      }"
+    />
     <v-line
       ref="line"
       :config="{

+ 1 - 1
src/core/components/triangle/index.ts

@@ -19,7 +19,7 @@ export const defaultStyle = {
 };
 
 export const addMode = "area";
-export const fixedStrokeOptions = [1, 2, 4];
+export const fixedStrokeOptions:number[] = [];
 
 export const getMouseStyle = (data: TriangleData) => {
   const fillStatus = data.fill && getMouseColors(data.fill);

+ 2 - 2
src/core/hook/use-describe.ts

@@ -10,7 +10,7 @@ import { Proportion } from "../store/store";
 export const useInstallStrokeWidthDescribe = (
   describes: Ref<PropertyDescribes>,
   shape: Ref<{ strokeWidth?: number; fixed?: boolean }>,
-  options = [1, 2, 4],
+  options: number[] = [],
   defProportion?: Proportion,
   fixed = false
 ) => {
@@ -20,7 +20,7 @@ export const useInstallStrokeWidthDescribe = (
   });
 
   watch(
-    () => [fixed || shape.value.fixed, proportion.value] as const,
+    () => [fixed || options.length > 0, proportion.value] as const,
     ([fixed, proportion]) => {
       if (fixed) {
         const property = getFixedStrokeWidthProperty(shape);

+ 18 - 2
src/example/components/slide/actions.ts

@@ -20,6 +20,7 @@ import { Size } from "@/utils/math";
 import { getBaseItem } from "@/core/components/util";
 import { loading } from "@/example/loadding";
 import { overviewMMToPixel } from "@/example/constant";
+import { Transform } from "konva/lib/Util";
 
 export type PresetAdd<T extends ShapeType = ShapeType> = {
   type: T;
@@ -41,7 +42,7 @@ export const draw: MenuItem = {
   value: uuid(),
   defSelect: true,
   children: [
-    { icon: "line", ...genDrawItem('lineChunk') },
+    { icon: "line", ...genDrawItem("lineChunk") },
     { icon: "line", ...genDrawItem("line") },
     { icon: "arrows", ...genDrawItem("arrow"), single: true },
     { icon: "rectangle", ...genDrawItem("rectangle"), single: true },
@@ -99,7 +100,6 @@ export const imp: MenuItem = {
         const realSize = result.info.size;
         const scale = 1000 * overviewMMToPixel;
 
-
         ElMessage.warning("请在画图面板中选择放置位置,鼠标右键取消");
         draw.enterDrawShape(
           "image",
@@ -169,6 +169,21 @@ export const paperConfigs = {
 };
 export type PaperKey = keyof typeof paperConfigs;
 
+export const initViewport = (draw: Draw, padding = 0.1) => {
+  const viewSize = draw.viewer.viewSize!;
+  const size = {
+    width: draw.stage!.width(),
+    height: draw.stage!.height(),
+  };
+  const scale =
+    Math.min(size.width / viewSize.width, size.height / viewSize.height) -
+    padding;
+  const mat = new Transform()
+    .translate(viewSize.width / 2, viewSize.height / 2)
+    .scale(scale, scale)
+    .translate(-viewSize.width / 2, -viewSize.height / 2);
+  draw.viewer.setViewMat(mat);
+};
 const setPaper = (draw: Draw, p: number[], scale: number) => {
   const { size, margin } = getPaperConfig(p, scale);
   // draw.config.size = size;
@@ -181,6 +196,7 @@ const setPaper = (draw: Draw, p: number[], scale: number) => {
     opacity: 1,
   };
   draw.config.margin = margin;
+  initViewport(draw);
 };
 
 export const paper = {

+ 3 - 3
src/example/fuse/enter-shared.ts

@@ -359,7 +359,7 @@ export let getTableTemp = async () => {
 
   if (!table!) {
     table = {
-      案发时间: "",
+      案发日期: "",
       案发地点: "",
       绘图单位: "",
       绘图人: "",
@@ -371,7 +371,7 @@ export let getTableTemp = async () => {
         num: window.platform.num,
       });
       if (item) {
-        table.案发时间 = item.crimeTimeBegin;
+        table.案发日期 = item.crimeTimeBegin;
         table.案发地点 = item.caseLocation;
         table.绘图单位 = item.orgName;
         table.绘图人 = item.investigatorName;
@@ -386,7 +386,7 @@ export let getTableTemp = async () => {
   if (!title) {
     title = "默认标题";
   }
-  return { table, title };
+  return { table, title, tableTitle: '绘图说明' };
 };
 
 export const getTileGroups = async () => {

+ 38 - 37
src/example/fuse/views/defStyle.ts

@@ -20,10 +20,12 @@ import {
   defaultTableStyle as serialTableDefStyle,
   joinKey,
 } from "@/core/components/serial";
+import { fixedStrokeOptions as serialFixedStrokeOptions } from "@/core/components/serial";
 import { defaultStyle as tableDefStyle } from "@/core/components/table";
+import { fixedStrokeOptions as tableFixedStrokeOptions  } from "@/core/components/table";
 import { PaperKey } from "@/example/components/slide/actions";
 import { mergeFuns } from "@/utils/shared";
-import { getRealPixel } from "./tabulation/gen-tab";
+import { getPixelReal, getRealPixel } from "./tabulation/gen-tab";
 import { Draw } from "@/example/components/container/use-draw";
 import { ShapeType } from "@/index";
 import { watch } from "vue";
@@ -47,32 +49,14 @@ const setDefStyle = <T extends {}>(
 };
 
 export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
-  const types = [
-    "icon",
-    "table",
-    "serial",
-    "arrow",
-    "circle",
-    "rectangle",
-    "triangle",
-    "polygon",
-  ] as ShapeType[];
-
+  const realFixedStrokeOptions = [0.13, 0.18, 0.25, 0.35, 0.5, 0.7];
+  const defFixelStroke = getRealPixel(realFixedStrokeOptions[0], p);
+  
+  const defF = {
+    strokeWidth: defFixelStroke,
+    fixed: false,
+  };
   const backs = [
-    mergeFuns(
-      types.map((type) =>
-        draw.mountFilter.setMenusFilter(type, (data) => {
-          data.strokeWidth.props = {
-            ...data.strokeWidth.props,
-            proportion: true,
-            step: 0.1,
-            min: 0.1,
-            max: 10,
-          };
-          return data;
-        })
-      )
-    ),
     draw.mountFilter.setMenusFilter("serial", (data) => {
       data = { ...data };
       delete data.fontStyle;
@@ -83,29 +67,24 @@ export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
       {
         width: getRealPixel(10, p),
         height: getRealPixel(10, p),
-        strokeWidth: getRealPixel(0.5, p),
+        strokeScaleEnabled: true,
       } as any,
       "icon"
     ),
     setDefStyle(serialDefStyle, {
-      strokeWidth: getRealPixel(0.5, p),
       fill: null,
+      fontSize: getRealPixel(8 - getPixelReal(6, p), p),
+      padding: 6,
     } as any),
     setDefStyle(serialTableDefStyle, {
-      nameColWidth: getRealPixel(20, p),
-      valueColWidth: getRealPixel(20, p),
+      nameColWidth: getRealPixel(10, p),
+      valueColWidth: getRealPixel(30, p),
       fontSize: getRealPixel(4, p),
       padding: getRealPixel(2, p),
       colHeight: getRealPixel(8, p),
       tableStrokeWidth: getRealPixel(0.5, p),
       repColCount: 2,
     } as any),
-    setDefStyle(polygonDefStyle, { strokeWidth: getRealPixel(0.5, p) }),
-    setDefStyle(tableDefStyle, { strokeWidth: getRealPixel(0.5, p) }),
-    setDefStyle(rectDefStyle, { strokeWidth: getRealPixel(0.5, p) }),
-    setDefStyle(circleDefStyle, { strokeWidth: getRealPixel(0.5, p) }),
-    setDefStyle(triangleDefStyle, { strokeWidth: getRealPixel(0.5, p) }),
-    setDefStyle(arrowDefStyle, { strokeWidth: getRealPixel(0.5, p) }),
     watch(
       () =>
         draw.store.getTypeItems("table").filter((item) => item.key === joinKey),
@@ -121,6 +100,29 @@ export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
       },
       { immediate: true }
     ),
+
+    setDefStyle(triangleFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(circleFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(arrowFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(rectFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(polygonFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(iconFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(lineIconFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(lineChunkFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(serialFixedStrokeOptions, realFixedStrokeOptions),
+    setDefStyle(tableFixedStrokeOptions, realFixedStrokeOptions),
+
+    setDefStyle(lineChunkDefStyle, defF),
+    setDefStyle(lineIconDefStyle, defF),
+    setDefStyle(iconDefStyle, defF),
+    setDefStyle(polygonDefStyle, defF),
+    setDefStyle(triangleDefStyle, defF),
+    setDefStyle(circleDefStyle, defF),
+    setDefStyle(arrowDefStyle, defF),
+    setDefStyle(rectDefStyle, defF),
+    setDefStyle(serialDefStyle, defF),
+    setDefStyle(tableDefStyle, defF),
+    setDefStyle(serialTableDefStyle, { tableStrokeWidth: defF.strokeWidth }),
   ];
 
   return mergeFuns(backs);
@@ -142,7 +144,6 @@ export const overviewCustomStyle = (draw: Draw) => {
     setDefStyle(iconFixedStrokeOptions, realFixedStrokeOptions),
     setDefStyle(lineIconFixedStrokeOptions, realFixedStrokeOptions),
     setDefStyle(lineChunkFixedStrokeOptions, realFixedStrokeOptions),
-    
 
     setDefStyle(lineChunkDefStyle, { strokeWidth: defFixelStroke }),
     setDefStyle(lineIconDefStyle, { strokeWidth: defFixelStroke }),

+ 8 - 2
src/example/fuse/views/tabulation/gen-tab.ts

@@ -37,6 +37,10 @@ export const getRealPixel = (real: number, paperKey: PaperKey) => {
   const realPixelScale = paperConfigs[paperKey].scale;
   return real * realPixelScale;
 };
+export const getPixelReal = (pixel: number, paperKey: PaperKey) => {
+  const realPixelScale = paperConfigs[paperKey].scale;
+  return pixel / realPixelScale;
+};
 
 export const transformPaper = (
   real: number,
@@ -103,6 +107,8 @@ export const genTabulationData = async (
       key: tableTableKey,
       width: nameColl.width + valueColl.width,
       height: nameColl.height * rows.length,
+      titleHeight: h,
+      title: temp.tableTitle,
       mat: [1, 0, 0, 1, 0, 0],
       fill: null,
     };
@@ -195,7 +201,7 @@ export const genTabulationData = async (
     const title = {
       ...getBaseItem(),
       content: temp.title,
-      width: getRealPixel(90, paperKey),
+      width: size.width - margin[1] - margin[3],
       heihgt: getRealPixel(14.4, paperKey),
       fontSize: getRealPixel(12, paperKey),
       key: tableTitleKey,
@@ -203,7 +209,7 @@ export const genTabulationData = async (
       mat: [1, 0, 0, 1, 0, 0],
     };
     const pos = {
-      x: (size.width - margin[3]) / 2 - getRealPixel(40, paperKey) + margin[3],
+      x: margin[3],
       y: getRealPixel(15, paperKey) + margin[0],
     };
     title.mat[4] = pos.x;

+ 2 - 4
src/example/fuse/views/tabulation/header.vue

@@ -31,7 +31,7 @@ import { Mode } from "@/constant/mode.ts";
 import { overviewId, tabulationId } from "@/example/env.ts";
 import { listener } from "@/utils/event.ts";
 import { router } from "../../router.ts";
-import { paperConfigs } from "@/example/components/slide/actions.ts";
+import { initViewport, paperConfigs } from "@/example/components/slide/actions.ts";
 
 const props = defineProps<{ title: string }>();
 
@@ -72,9 +72,7 @@ const actions = [
     // baseActions.clear,
     {
       ...baseActions.initViewport,
-      handler: () => {
-        draw.viewer.setViewMat(new Transform());
-      },
+      handler: initViewport.bind(null, draw, 0.05),
     },
   ],
   [

+ 4 - 0
src/example/fuse/views/tabulation/index.vue

@@ -146,6 +146,10 @@ const init = async (draw: Draw) => {
         scale: 1 / getRealPixel(1, p),
         unit: "mm",
       },
+      strokeProportion: {
+        scale: 1 / getRealPixel(1, p),
+        unit: "mm",
+      },
     },
   });
   inited.value = true;

+ 8 - 7
src/example/fuse/views/tabulation/slide.vue

@@ -43,6 +43,7 @@ const paper = reactive({
 
 const drawMenu = copy(drawMenuRaw);
 drawMenu.children!.shift();
+drawMenu.children!.shift();
 drawMenu.name = "标注";
 
 let tileGroups: TileGroup[];
@@ -64,13 +65,13 @@ const menus = reactive([
     },
   },
   drawMenu,
-  {
-    icon: "legend",
-    name: "图例",
-    value: uuid(),
-    mount: (props: any) =>
-      h(SlideIcons, { ...props, groups: [iconGroups[iconGroups.length - 1]] }),
-  },
+  // {
+  //   icon: "legend",
+  //   name: "图例",
+  //   value: uuid(),
+  //   mount: (props: any) =>
+  //     h(SlideIcons, { ...props, groups: [iconGroups[iconGroups.length - 1]] }),
+  // },
   {
     ...text,
     payload: { ...text.payload, preset: { ...text.payload.preset, fontSize: 16 } },