File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments