feat: 调整描述区字体大小计算逻辑以适应不同区域尺寸,并在跳转功能中添加临时点检查与缩放调整

This commit is contained in:
xudan 2025-08-12 17:52:32 +08:00
parent 71def4de74
commit 8e6b317348
2 changed files with 11 additions and 1 deletions

View File

@ -1468,7 +1468,7 @@ function drawArea(ctx: CanvasRenderingContext2D, pen: MapPen): void {
ctx.fillStyle = get(theme, 'color') ?? '';
// 动态计算字体大小,让文字填充区域
let descFontSize = Math.min(w / 2, h / 2, 200);
let descFontSize = Math.min(w / 6, h / 4, 200);
let lines: string[] = [];
while (descFontSize > 8) {

View File

@ -207,6 +207,16 @@ export function useViewState() {
*/
const jumpToPosition = async (editor: EditorService, x: number, y: number): Promise<void> => {
try {
// 检查是否已存在临时点
const existingTempPoints = editor
.find('point')
.filter((point) => point.id && point.id.includes('view-center-point'));
// 如果没有临时点调整缩放比例到8%
if (existingTempPoints.length === 0) {
editor.scale(0.08);
}
// 创建临时点位用于跳转
const centerPointId = 'view-center-point-' + Date.now();