mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 13:26:07 +08:00
underline width fix
This commit is contained in:
5
konva.js
5
konva.js
@@ -13087,6 +13087,7 @@
|
|||||||
letterSpacing = this.getLetterSpacing(),
|
letterSpacing = this.getLetterSpacing(),
|
||||||
textDecoration = this.textDecoration(),
|
textDecoration = this.textDecoration(),
|
||||||
fill = this.fill(),
|
fill = this.fill(),
|
||||||
|
fontSize = this.fontSize(),
|
||||||
n;
|
n;
|
||||||
|
|
||||||
context.setAttr('font', this._getContextFont());
|
context.setAttr('font', this._getContextFont());
|
||||||
@@ -13123,7 +13124,9 @@
|
|||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.moveTo(0, Math.round(lineHeightPx / 2));
|
context.moveTo(0, Math.round(lineHeightPx / 2));
|
||||||
context.lineTo(Math.round(width), Math.round(lineHeightPx / 2));
|
context.lineTo(Math.round(width), Math.round(lineHeightPx / 2));
|
||||||
// context
|
// TODO: I have no idea what is real ratio
|
||||||
|
// just /20 looks good enough
|
||||||
|
context.lineWidth = fontSize / 20;
|
||||||
context.strokeStyle = fill;
|
context.strokeStyle = fill;
|
||||||
context.stroke();
|
context.stroke();
|
||||||
context.restore();
|
context.restore();
|
||||||
|
|||||||
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -107,6 +107,7 @@
|
|||||||
letterSpacing = this.getLetterSpacing(),
|
letterSpacing = this.getLetterSpacing(),
|
||||||
textDecoration = this.textDecoration(),
|
textDecoration = this.textDecoration(),
|
||||||
fill = this.fill(),
|
fill = this.fill(),
|
||||||
|
fontSize = this.fontSize(),
|
||||||
n;
|
n;
|
||||||
|
|
||||||
context.setAttr('font', this._getContextFont());
|
context.setAttr('font', this._getContextFont());
|
||||||
@@ -143,7 +144,9 @@
|
|||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.moveTo(0, Math.round(lineHeightPx / 2));
|
context.moveTo(0, Math.round(lineHeightPx / 2));
|
||||||
context.lineTo(Math.round(width), Math.round(lineHeightPx / 2));
|
context.lineTo(Math.round(width), Math.round(lineHeightPx / 2));
|
||||||
// context
|
// TODO: I have no idea what is real ratio
|
||||||
|
// just /20 looks good enough
|
||||||
|
context.lineWidth = fontSize / 20;
|
||||||
context.strokeStyle = fill;
|
context.strokeStyle = fill;
|
||||||
context.stroke();
|
context.stroke();
|
||||||
context.restore();
|
context.restore();
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ suite('Text', function(){
|
|||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
text: 'hello\nworld',
|
text: 'hello\nworld',
|
||||||
fontSize: 15,
|
fontSize: 80,
|
||||||
fill: 'red',
|
fill: 'red',
|
||||||
letterSpacing: 5,
|
letterSpacing: 5,
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
|
|||||||
Reference in New Issue
Block a user