Skip to content

Commit d9b3540

Browse files
committed
fix:placeholder
1 parent af4554c commit d9b3540

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/pen/render.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,14 +1034,14 @@ function drawText(ctx: CanvasRenderingContext2D, pen: Pen) {
10341034
const textLineWidth = ctx.measureText(pen.placeholder || '请输入').width;
10351035
const rect = pen.calculative.worldTextRect;
10361036
let x = 0;
1037-
let y = 0;
1037+
let y = (rect.height - pen.calculative.fontSize) / 2;
10381038
if (pen.textAlign === 'center') {
10391039
x = (rect.width - textLineWidth) / 2;
10401040
} else if (pen.textAlign === 'right') {
10411041
x = rect.width - textLineWidth;
10421042
}
1043-
if (pen.textBaseline === 'middle') {
1044-
y = (rect.height - pen.calculative.fontSize) / 2;
1043+
if (pen.textBaseline === 'top') {
1044+
y = 0;
10451045
} else if (pen.textBaseline === 'bottom') {
10461046
y = rect.height - pen.calculative.fontSize;
10471047
}

0 commit comments

Comments
 (0)