feat: 调整描述区字体大小计算逻辑以适应不同区域尺寸,并在跳转功能中添加临时点检查与缩放调整
This commit is contained in:
parent
71def4de74
commit
8e6b317348
@ -1468,7 +1468,7 @@ function drawArea(ctx: CanvasRenderingContext2D, pen: MapPen): void {
|
|||||||
ctx.fillStyle = get(theme, 'color') ?? '';
|
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[] = [];
|
let lines: string[] = [];
|
||||||
|
|
||||||
while (descFontSize > 8) {
|
while (descFontSize > 8) {
|
||||||
|
@ -207,6 +207,16 @@ export function useViewState() {
|
|||||||
*/
|
*/
|
||||||
const jumpToPosition = async (editor: EditorService, x: number, y: number): Promise<void> => {
|
const jumpToPosition = async (editor: EditorService, x: number, y: number): Promise<void> => {
|
||||||
try {
|
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();
|
const centerPointId = 'view-center-point-' + Date.now();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user