bill 2 months ago
parent
commit
84a68fb472

+ 1 - 3
src/core/components/serial/serial-group.vue

@@ -24,7 +24,7 @@ import {
   TableData,
   interactiveToData as tableInteractiveToData,
 } from "../table";
-import { defaultTableStyle, delItem, getCurrentNdx, SerialData } from ".";
+import { defaultTableStyle, delItem, getCurrentNdx, joinKey, SerialData } from ".";
 import {
   useGetViewBoxPositionPixel,
   useViewerInvertTransform,
@@ -42,7 +42,6 @@ const addHandler = (value: SerialData) => {
   store.addItem("serial", value);
 };
 
-const joinKey = "serial-table";
 const jTable = computed(() =>
   store.getTypeItems("table").find((item) => item.key === joinKey)
 );
@@ -102,7 +101,6 @@ const addTable = () => {
     );
   }
 
-  console.log("===>", defaultTableStyle.tableStrokeWidth);
   return tableInteractiveToData({
     info: { cur: [pos, end] },
     preset: {

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

@@ -17,12 +17,12 @@ export { default as TempComponent } from "./temp-table.vue";
 
 export const shapeName = "表格";
 export const defaultStyle = {
-  stroke: '#000',
+  stroke: '#000000',
   strokeWidth: 1,
   fontSize: 16,
   align: "center",
   fontStyle: "normal",
-  fontColor: '#000',
+  fontColor: '#000000',
 };
 export const defaultCollData = {
   fontFamily: "Calibri",
@@ -45,7 +45,7 @@ export type TableCollData = Partial<typeof defaultCollData> &
 export type TableData = Partial<typeof defaultStyle> &
   BaseItem &
   Size & {
-    fill?: string
+    fill?: string | null
     notaddRow?: boolean;
     notaddCol?: boolean;
     mat: number[];
@@ -86,6 +86,7 @@ export const interactiveToData: InteractiveTo<"table"> = ({
 }) => {
   if (info.cur) {
     const item = {
+      fill: null,
       ...defaultStyle,
       ...getBaseItem(),
       ...preset,

+ 40 - 6
src/example/fuse/views/defStyle.ts

@@ -3,13 +3,18 @@ import { defaultStyle as rectDefStyle } from "@/core/components/rectangle";
 import { defaultStyle as circleDefStyle } from "@/core/components/circle";
 import { defaultStyle as triangleDefStyle } from "@/core/components/triangle";
 import { defaultStyle as arrowDefStyle } from "@/core/components/arrow";
-import { defaultStyle as serialDefStyle, defaultTableStyle as serialTableDefStyle } from "@/core/components/serial";
+import {
+  defaultStyle as serialDefStyle,
+  defaultTableStyle as serialTableDefStyle,
+  joinKey,
+} from "@/core/components/serial";
 import { defaultStyle as tableDefStyle } from "@/core/components/table";
 import { PaperKey } from "@/example/components/slide/actions";
 import { mergeFuns } from "@/utils/shared";
 import { getRealPixel } from "./tabulation/gen-tab";
 import { Draw } from "@/example/components/container/use-draw";
 import { ShapeType } from "@/index";
+import { watch } from "vue";
 
 const setDefStyle = <T extends {}>(
   sys: T,
@@ -29,7 +34,16 @@ const setDefStyle = <T extends {}>(
 };
 
 export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
-  const types = ["icon", "table", "serial", 'arrow', 'circle', 'rectangle', 'triangle', 'polygon'] as ShapeType[];
+  const types = [
+    "icon",
+    "table",
+    "serial",
+    "arrow",
+    "circle",
+    "rectangle",
+    "triangle",
+    "polygon",
+  ] as ShapeType[];
   types.forEach((type) => {
     draw.mountFilter.setMenusFilter(type, (data) => {
       data.strokeWidth.props = {
@@ -37,17 +51,23 @@ export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
         proportion: true,
         step: 0.1,
         min: 0.1,
-        max: 10
+        max: 10,
       };
       return data;
     });
   });
+  draw.mountFilter.setMenusFilter('serial', data => {
+    data = {...data}
+    delete data.fontStyle
+    return data
+  })
 
   const backs = [
     () => {
       types.forEach((type) => {
         draw.mountFilter.setMenusFilter(type);
       });
+      draw.mountFilter.setMenusFilter('serial')
     },
     setDefStyle(
       iconDefStyle,
@@ -76,6 +96,22 @@ export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
     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),
+      (serialTables, _, onCleanup) => {
+        const fns = serialTables.map((item) => {
+          draw.mountFilter.setShapeMenusFilter(item.id, item => {
+            const c = {...item}
+            delete c.align
+            return c
+          })
+          return () => draw.menusFilter.setShapeMenusFilter(item.id)
+        });
+        onCleanup(mergeFuns(fns))
+      },
+      { immediate: true }
+    ),
   ];
 
   return mergeFuns(backs);
@@ -90,9 +126,7 @@ export const overviewCustomStyle = (draw: Draw) => {
     return data;
   });
   const backs = [
-    () => {
-      draw.mountFilter.setMenusFilter("icon");
-    },
+    () => draw.mountFilter.setMenusFilter("icon"),
     setDefStyle(
       iconDefStyle,
       {

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

@@ -87,6 +87,7 @@ export const genTabulationData = async (paperKey: PaperKey, compass?: number, co
       width: nameColl.width + valueColl.width,
       height: nameColl.height * 5,
       mat: [1, 0, 0, 1, 0, 0],
+      fill: null
     };
 
     const pos = getFixPosition(

+ 2 - 3
src/example/platform/platform-draw.ts

@@ -89,8 +89,8 @@ const getResourceLayers = (data: AIExposeData) => {
   return data.floors
     .map((floor) => {
       let box: SceneFloor["box"];
-      // if (true) {
-      if (!floor.box || !floor.box.bound.x_max || !floor.box.bound.z_max) {
+      if (true) {
+      // if (!floor.box || !floor.box.bound.x_max || !floor.box.bound.z_max) {
         const xs = floor.geos.flatMap((item) => item.map((p) => p.x));
         const ys = floor.geos.flatMap((item) => item.map((p) => p.y));
         const zs = floor.geos.flatMap((item) => item.map((p) => p.z));
@@ -382,7 +382,6 @@ export const drawPlatformResource = async (data: AIExposeData, draw: Draw) => {
       // draw.store.setCurrentLayer(layer.name);
       layerBounds.push(await drawLayerResource(layer, draw)!);
     }
-    console.error(data.compass)
     if (typeof data.compass === "number") {
       draw.store.setConfig({
         compass: {