From eb336bdb015cd5a1e9ca7c99f871470fa94a89b2 Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Wed, 13 Nov 2024 14:25:06 +0800 Subject: [PATCH] fix: change console warn --- .../src/core/contributions/textMeasure/AtextMeasure.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vrender-core/src/core/contributions/textMeasure/AtextMeasure.ts b/packages/vrender-core/src/core/contributions/textMeasure/AtextMeasure.ts index 10567774d..810e9ef04 100644 --- a/packages/vrender-core/src/core/contributions/textMeasure/AtextMeasure.ts +++ b/packages/vrender-core/src/core/contributions/textMeasure/AtextMeasure.ts @@ -4,6 +4,7 @@ import type { ICanvas, IContext2d, EnvType } from '../../../interface'; import type { TextOptionsType, ITextMeasure } from '../../../interface/text'; import { DefaultTextAttribute, DefaultTextStyle } from '../../../graphic/config'; import { testLetter } from '../../../graphic/richtext/utils'; +import { Logger } from '@visactor/vutils'; @injectable() export class ATextMeasure implements ITextMeasure { @@ -233,7 +234,8 @@ export class ATextMeasure implements ITextMeasure { ): { str: string; width: number } { // 添加退出条件,如果leftIdx和rightIdx相等,那么就返回这个字符串(理论上这时出问题了) if (leftIdx === rightIdx) { - console.warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`); + Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`); + // console.warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`); const subText = text.substring(0, rightIdx + 1); return { str: subText, width: this.measureTextWidth(subText, options) }; }