|
@@ -23,7 +23,7 @@ import {
|
|
|
} from "@/core/components/serial";
|
|
} from "@/core/components/serial";
|
|
|
import { fixedStrokeOptions as serialFixedStrokeOptions } from "@/core/components/serial";
|
|
import { fixedStrokeOptions as serialFixedStrokeOptions } from "@/core/components/serial";
|
|
|
import { defaultStyle as tableDefStyle } from "@/core/components/table";
|
|
import { defaultStyle as tableDefStyle } from "@/core/components/table";
|
|
|
-import { fixedStrokeOptions as tableFixedStrokeOptions } from "@/core/components/table";
|
|
|
|
|
|
|
+import { fixedStrokeOptions as tableFixedStrokeOptions } from "@/core/components/table";
|
|
|
import { PaperKey } from "@/example/components/slide/actions";
|
|
import { PaperKey } from "@/example/components/slide/actions";
|
|
|
import { mergeFuns } from "@/utils/shared";
|
|
import { mergeFuns } from "@/utils/shared";
|
|
|
import { getPixelReal, getRealPixel } from "./tabulation/gen-tab";
|
|
import { getPixelReal, getRealPixel } from "./tabulation/gen-tab";
|
|
@@ -34,7 +34,7 @@ import { overviewBorderMMToPixel, overviewMMToPixel } from "@/example/constant";
|
|
|
const setDefStyle = <T extends {}>(
|
|
const setDefStyle = <T extends {}>(
|
|
|
sys: T,
|
|
sys: T,
|
|
|
custom: Partial<T>,
|
|
custom: Partial<T>,
|
|
|
- _itemKey?: string
|
|
|
|
|
|
|
+ _itemKey?: string,
|
|
|
) => {
|
|
) => {
|
|
|
const backs: (() => void)[] = [];
|
|
const backs: (() => void)[] = [];
|
|
|
for (const key in custom) {
|
|
for (const key in custom) {
|
|
@@ -49,117 +49,131 @@ const setDefStyle = <T extends {}>(
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
|
|
export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
|
|
|
- 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,
|
|
|
|
|
- };
|
|
|
|
|
- console.log(defF)
|
|
|
|
|
- const backs = [
|
|
|
|
|
- draw.mountFilter.setMenusFilter("serial", (data) => {
|
|
|
|
|
- data = { ...data };
|
|
|
|
|
- delete data.fontStyle;
|
|
|
|
|
- return data;
|
|
|
|
|
- }),
|
|
|
|
|
- setDefStyle(
|
|
|
|
|
- iconDefStyle,
|
|
|
|
|
- {
|
|
|
|
|
- width: getRealPixel(10, p),
|
|
|
|
|
- height: getRealPixel(10, p),
|
|
|
|
|
- strokeScaleEnabled: true,
|
|
|
|
|
- } as any,
|
|
|
|
|
- "icon"
|
|
|
|
|
- ),
|
|
|
|
|
- setDefStyle(serialDefStyle, {
|
|
|
|
|
- fill: null,
|
|
|
|
|
- fontSize: getRealPixel(8 - getPixelReal(6, p), p),
|
|
|
|
|
- padding: 6,
|
|
|
|
|
- } as any),
|
|
|
|
|
- setDefStyle(serialTableDefStyle, {
|
|
|
|
|
- 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),
|
|
|
|
|
- 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;
|
|
|
|
|
- })
|
|
|
|
|
- );
|
|
|
|
|
- onCleanup(mergeFuns(fns));
|
|
|
|
|
- },
|
|
|
|
|
- { immediate: true }
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ return draw.runHook(() => {
|
|
|
|
|
+ const realFixedStrokeOptions = [0.13, 0.18, 0.25, 0.35, 0.5, 0.7];
|
|
|
|
|
+ const defFixelStroke = getRealPixel(realFixedStrokeOptions[0], p);
|
|
|
|
|
|
|
|
- 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),
|
|
|
|
|
|
|
+ const defF = {
|
|
|
|
|
+ strokeWidth: defFixelStroke,
|
|
|
|
|
+ fixed: false,
|
|
|
|
|
+ };
|
|
|
|
|
+ const backs = [
|
|
|
|
|
+ draw.mountFilter.setMenusFilter("serial", (data) => {
|
|
|
|
|
+ data = { ...data };
|
|
|
|
|
+ delete data.fontStyle;
|
|
|
|
|
+ return data;
|
|
|
|
|
+ }),
|
|
|
|
|
+ setDefStyle(
|
|
|
|
|
+ iconDefStyle,
|
|
|
|
|
+ {
|
|
|
|
|
+ width: getRealPixel(10, p),
|
|
|
|
|
+ height: getRealPixel(10, p),
|
|
|
|
|
+ strokeScaleEnabled: true,
|
|
|
|
|
+ } as any,
|
|
|
|
|
+ "icon",
|
|
|
|
|
+ ),
|
|
|
|
|
+ setDefStyle(serialDefStyle, {
|
|
|
|
|
+ fill: null,
|
|
|
|
|
+ fontSize: getRealPixel(8 - getPixelReal(6, p), p),
|
|
|
|
|
+ padding: 6,
|
|
|
|
|
+ } as any),
|
|
|
|
|
+ setDefStyle(serialTableDefStyle, {
|
|
|
|
|
+ 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),
|
|
|
|
|
+ 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;
|
|
|
|
|
+ }),
|
|
|
|
|
+ );
|
|
|
|
|
+ onCleanup(mergeFuns(fns));
|
|
|
|
|
+ },
|
|
|
|
|
+ { immediate: true },
|
|
|
|
|
+ ),
|
|
|
|
|
|
|
|
- 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 }),
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ 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),
|
|
|
|
|
|
|
|
- return mergeFuns(backs);
|
|
|
|
|
|
|
+ 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 () => {
|
|
|
|
|
+ draw.runHook(mergeFuns(backs));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const getOverviewRealPixel = (real: number, border = false) =>
|
|
const getOverviewRealPixel = (real: number, border = false) =>
|
|
|
real * (border ? overviewBorderMMToPixel : overviewMMToPixel);
|
|
real * (border ? overviewBorderMMToPixel : overviewMMToPixel);
|
|
|
|
|
|
|
|
-export const overviewCustomStyle = (_draw: Draw) => {
|
|
|
|
|
- const realFixedStrokeOptions = [0.13, 0.18, 0.25, 0.35, 0.5, 0.7];
|
|
|
|
|
- const defFixelStroke = getOverviewRealPixel(realFixedStrokeOptions[0], true);
|
|
|
|
|
- autoGenTable.value = false
|
|
|
|
|
- const backs = [
|
|
|
|
|
- () => autoGenTable.value = true,
|
|
|
|
|
- setDefStyle(lineDefStyle, { strokeWidth: getOverviewRealPixel(120) }),
|
|
|
|
|
- setDefStyle(serialFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(triangleFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(circleFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(arrowFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(rectFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(polygonFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(iconFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(lineIconFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
- setDefStyle(lineChunkFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
|
|
+export const overviewCustomStyle = (draw: Draw) => {
|
|
|
|
|
+ return draw.runHook(() => {
|
|
|
|
|
+ const realFixedStrokeOptions = [0.13, 0.18, 0.25, 0.35, 0.5, 0.7];
|
|
|
|
|
+ const defFixelStroke = getOverviewRealPixel(
|
|
|
|
|
+ realFixedStrokeOptions[0],
|
|
|
|
|
+ true,
|
|
|
|
|
+ );
|
|
|
|
|
+ autoGenTable.value = false;
|
|
|
|
|
+ const backs = [
|
|
|
|
|
+ () => (autoGenTable.value = true),
|
|
|
|
|
+ setDefStyle(lineDefStyle, { strokeWidth: getOverviewRealPixel(120) }),
|
|
|
|
|
+ setDefStyle(serialFixedStrokeOptions, realFixedStrokeOptions),
|
|
|
|
|
+ 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(serialDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(lineChunkDefStyle, { strokeWidth: getOverviewRealPixel(realFixedStrokeOptions[2], true) }),
|
|
|
|
|
- setDefStyle(lineIconDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(iconDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(polygonDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(triangleDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(circleDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(arrowDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(rectDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
- setDefStyle(iconDefStyle, { strokeWidth: 1 } as any, "icon"),
|
|
|
|
|
- setDefStyle(lineIconDefStyle, { strokeWidth: 1 } as any, "icon"),
|
|
|
|
|
- ];
|
|
|
|
|
- return mergeFuns(backs);
|
|
|
|
|
|
|
+ setDefStyle(serialDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(lineChunkDefStyle, {
|
|
|
|
|
+ strokeWidth: getOverviewRealPixel(realFixedStrokeOptions[2], true),
|
|
|
|
|
+ }),
|
|
|
|
|
+ setDefStyle(lineIconDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(iconDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(polygonDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(triangleDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(circleDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(arrowDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(rectDefStyle, { strokeWidth: defFixelStroke }),
|
|
|
|
|
+ setDefStyle(iconDefStyle, { strokeWidth: 1 } as any, "icon"),
|
|
|
|
|
+ setDefStyle(lineIconDefStyle, { strokeWidth: 1 } as any, "icon"),
|
|
|
|
|
+ ];
|
|
|
|
|
+ return () => {
|
|
|
|
|
+ draw.runHook(mergeFuns(backs));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|