feat: add render mode #667

This commit is contained in:
Hufe921
2024-07-04 21:52:46 +08:00
parent 0e705d6a0b
commit affd191155
8 changed files with 28 additions and 7 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
import { ElementType, IEditorOption, IElement } from '../../..'
import { ElementType, IEditorOption, IElement, RenderMode } from '../../..'
import {
PUNCTUATION_LIST,
METRICS_BASIS_TEXT
@@ -124,6 +124,15 @@ export class TextParticle {
y: number
) {
this.ctx = ctx
// 兼容模式立即绘制
if (this.options.renderMode === RenderMode.COMPATIBILITY) {
this._setCurXY(x, y)
this.text = element.value
this.curStyle = element.style
this.curColor = element.color
this.complete()
return
}
// 主动完成的重设起始点
if (!this.text) {
this._setCurXY(x, y)