|
@@ -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(
|