bill před 2 měsíci
rodič
revize
ad49f8515c

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

@@ -80,6 +80,7 @@ export const interactiveToData: InteractiveTo<'circle'> = ({
   if (info.cur) {
     const item = {
       ...defaultStyle,
+      fill: null,
       ...getBaseItem(),
       ...preset,
     } as unknown as CircleData;

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

@@ -168,7 +168,6 @@ export const interactiveFixData: InteractiveFix<"icon"> = ({
     const mat = new Transform().translate(info.cur!.x, info.cur!.y);
     data.mat = mat.m;
   }
-  console.error(data)
   return data;
 };
 

+ 3 - 2
src/core/components/polygon/index.ts

@@ -47,7 +47,7 @@ export const getSnapPoints = (data: PolygonData) => {
 
 export type PolygonData = Partial<typeof defaultStyle> &
   BaseItem & {
-    fill?: string;
+    fill?: string | null;
     points: Pos[];
     attitude: number[];
   };
@@ -63,8 +63,9 @@ export const interactiveToData: InteractiveTo<"polygon"> = ({
       info,
       data: {
         ...getBaseItem(),
-        ...preset,
         ...defaultStyle,
+        fill: null,
+        ...preset,
         points: [],
         attitude: [1, 0, 0, 1, 0, 0],
       },

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

@@ -72,6 +72,7 @@ export const interactiveToData: InteractiveTo<"rectangle"> = ({
     const item = {
       ...getBaseItem(),
       ...defaultStyle,
+      fill: null,
       ...preset,
       id: onlyId(),
       createTime: Date.now(),

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

@@ -60,8 +60,9 @@ export const interactiveToData: InteractiveTo<"triangle"> = ({
   if (info.cur) {
     const item = {
       ...getBaseItem(),
-      ...preset,
       ...defaultStyle,
+      fill: null,
+      ...preset,
       points: [],
     } as unknown as TriangleData;
     return interactiveFixData({ ...args, info, data: item });

+ 6 - 6
src/core/hook/use-dxf.ts

@@ -300,18 +300,18 @@ export const useGetDXF = () => {
             if (isStart) {
               const start = vector
                 .clone()
-                .multiplyScalar(item.pointerLength!)
+                .multiplyScalar(item.pointerLength! * 2)
                 .add(line[0]);
               nline[0] = start;
               const l1 = verticalVectorLine(
                 vector,
                 start,
-                item.pointerLength! / 2
+                item.pointerLength! 
               );
               const l2 = verticalVectorLine(
                 vector,
                 start,
-                -item.pointerLength! / 2
+                -item.pointerLength! 
               );
               writerPolyline({
                 points: [line[0], l1[1], l2[1]],
@@ -322,18 +322,18 @@ export const useGetDXF = () => {
             if (isEnd) {
               const start = vector
                 .clone()
-                .multiplyScalar(-item.pointerLength!)
+                .multiplyScalar(-item.pointerLength! * 2)
                 .add(line[1]);
               nline[1] = start;
               const l1 = verticalVectorLine(
                 vector,
                 start,
-                item.pointerLength! / 2
+                item.pointerLength! 
               );
               const l2 = verticalVectorLine(
                 vector,
                 start,
-                -item.pointerLength! / 2
+                -item.pointerLength! 
               );
               writerPolyline({
                 points: [line[1], l1[1], l2[1]],

+ 13 - 8
src/example/fuse/views/overview/header.vue

@@ -81,12 +81,14 @@ const setViewToTableCover = async () => {
   const oldBack = draw.config.back;
   const oldShowCompass = draw.config.showCompass;
   const oldLabelLineConfig = { ...draw.config.labelLineConfig };
+  const oldShowOffset = draw.config.labelLineConfig.showOffset;
   const getRect = () => draw.stage!.findOne<Group>(`#${DataGroupId}`)!.getClientRect();
 
   const pop = draw.mode.push(Mode.readonly);
   const rect = getRect();
   const rectScale = (rect.width || 1080) / (rect.height || 850);
   const tableCoverScale = tableCoverWidth / tableCoverHeight;
+  const padding = 70;
 
   let width: number, height: number;
   if (rectScale > tableCoverScale) {
@@ -96,6 +98,12 @@ const setViewToTableCover = async () => {
     height = 850;
     width = rectScale * height;
   }
+  if (width < padding * 2) {
+    width += padding * 2;
+  }
+  if (height < padding * 2) {
+    height += padding * 2;
+  }
 
   draw.config.size = { width, height };
   draw.config.showGrid = false;
@@ -104,20 +112,17 @@ const setViewToTableCover = async () => {
 
   draw.config.labelLineConfig.type = "auto";
   draw.config.labelLineConfig.strokeWidth = 2;
-  draw.config.labelLineConfig.fontSize = 16;
+  draw.config.labelLineConfig.fontSize = 10;
 
   await nextTick();
-  const padding = 20;
+  draw.config.labelLineConfig.showOffset = padding;
   draw.initViewport(padding);
   await nextTick();
 
-  const currentRect = getRect();
   return [
     {
-      x: currentRect.x - padding,
-      y: currentRect.y - padding,
-      width: currentRect.width + 2 * padding,
-      height: currentRect.height + 2 * padding,
+      width,
+      height,
     },
     () => {
       pop();
@@ -126,6 +131,7 @@ const setViewToTableCover = async () => {
       draw.config.back = oldBack;
       draw.config.showCompass = oldShowCompass;
       draw.config.labelLineConfig = oldLabelLineConfig;
+      draw.config.labelLineConfig.showOffset = oldShowOffset;
       draw.viewer.setViewMat(oldViewMat);
     },
   ] as const;
@@ -163,7 +169,6 @@ const saveHandler = repeatedlyOnly(async () => {
     proportion: { ...draw.store.config.proportion, scale },
   };
 
-  console.log({ ...storeData.config.compass });
   tabulationId.value = await window.platform.getTabulationId(overviewId.value);
   await refreshTabulationData();
   const tabStore = await repTabulationStore(

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

@@ -262,7 +262,9 @@ export const repTabulationStore = async (paperKey: PaperKey, compass?: number, c
     const imageData = repData.image[0]
     const images = layer.image || []
     const imageNdx = images.findIndex(item => item.key === imageData.key)
+    
     if (~imageNdx) {
+      images[imageNdx] = imageData
       images[imageNdx] = {
         ...imageData,
         mat: images[imageNdx].mat