mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 07:25:56 +08:00
update CHANGELOG with new version
This commit is contained in:
parent
f31d6f5a36
commit
a863db9580
@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 8.3.5 (2022-03-21)
|
||||
|
||||
- Quick fix for `toCanvas()` and `toDataURL()` size calculation.
|
||||
|
||||
## 8.3.4 (2022-03-13)
|
||||
|
||||
- Fix characters positions calculations on `fontFamily` changes in `TextPath`.
|
||||
|
10
konva.js
10
konva.js
@ -8,7 +8,7 @@
|
||||
* Konva JavaScript Framework v8.3.4
|
||||
* http://konvajs.org/
|
||||
* Licensed under the MIT
|
||||
* Date: Sun Mar 13 2022
|
||||
* Date: Mon Mar 21 2022
|
||||
*
|
||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
||||
@ -3975,9 +3975,11 @@
|
||||
_toKonvaCanvas(config) {
|
||||
config = config || {};
|
||||
var box = this.getClientRect();
|
||||
var stage = this.getStage(), x = config.x !== undefined ? config.x : box.x, y = config.y !== undefined ? config.y : box.y, pixelRatio = config.pixelRatio || 1, canvas = new SceneCanvas({
|
||||
width: config.width || box.width || (stage ? stage.width() : 0),
|
||||
height: config.height || box.height || (stage ? stage.height() : 0),
|
||||
var stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new SceneCanvas({
|
||||
width: config.width || Math.ceil(box.width) || (stage ? stage.width() : 0),
|
||||
height: config.height ||
|
||||
Math.ceil(box.height) ||
|
||||
(stage ? stage.height() : 0),
|
||||
pixelRatio: pixelRatio,
|
||||
}), context = canvas.getContext();
|
||||
context.save();
|
||||
|
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
12
src/Node.ts
12
src/Node.ts
@ -1889,12 +1889,16 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
var box = this.getClientRect();
|
||||
|
||||
var stage = this.getStage(),
|
||||
x = config.x !== undefined ? config.x : box.x,
|
||||
y = config.y !== undefined ? config.y : box.y,
|
||||
x = config.x !== undefined ? config.x : Math.floor(box.x),
|
||||
y = config.y !== undefined ? config.y : Math.floor(box.y),
|
||||
pixelRatio = config.pixelRatio || 1,
|
||||
canvas = new SceneCanvas({
|
||||
width: config.width || box.width || (stage ? stage.width() : 0),
|
||||
height: config.height || box.height || (stage ? stage.height() : 0),
|
||||
width:
|
||||
config.width || Math.ceil(box.width) || (stage ? stage.width() : 0),
|
||||
height:
|
||||
config.height ||
|
||||
Math.ceil(box.height) ||
|
||||
(stage ? stage.height() : 0),
|
||||
pixelRatio: pixelRatio,
|
||||
}),
|
||||
context = canvas.getContext();
|
||||
|
@ -19,34 +19,162 @@
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.7/hammer.js"></script> -->
|
||||
<!-- <script src="https://cdn.rawgit.com/hammerjs/touchemulator/master/touch-emulator.js"></script> -->
|
||||
<!-- <script src="./hammer.js"></script> -->
|
||||
<script src="https://unpkg.com/fabric@5.2.1/dist/fabric.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<table>
|
||||
<tr>
|
||||
<td >
|
||||
Circle Radius <input type="range" style="width: 100%;" value="2" max="100" min="-100" />
|
||||
</td>
|
||||
<td> </td>
|
||||
<td>
|
||||
path: <span id="path"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span> konva</span>
|
||||
<div id="container" style="background-color:bisque;"></div>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td>
|
||||
<span>fabric</span>
|
||||
<div style="background-color:bisque;">
|
||||
<canvas id="canvas" width="600" height="600">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="module">
|
||||
import Konva from '../src/index.ts';
|
||||
const stage = new Konva.Stage({
|
||||
container: 'container',
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
});
|
||||
|
||||
const layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
//按textPath参数, 测量文本宽度
|
||||
function getTextWidth(txtPath) {
|
||||
let atxt = new Konva.Text();
|
||||
atxt.fontFamily(txtPath.fontFamily());
|
||||
atxt.letterSpacing(txtPath.letterSpacing());
|
||||
atxt.fontSize(txtPath.fontSize());
|
||||
atxt.fontStyle(txtPath.fontStyle());
|
||||
atxt.fontVariant(txtPath.fontVariant());
|
||||
let w = atxt.measureSize(txt.text()).width;
|
||||
atxt.destroy();
|
||||
return w + 5;
|
||||
}
|
||||
|
||||
const rect = new Konva.Rect({
|
||||
x: 90,
|
||||
y: 90,
|
||||
width: 100,
|
||||
height: 100,
|
||||
fill: 'red',
|
||||
draggable: true,
|
||||
});
|
||||
layer.add(rect);
|
||||
var s = '对象是在画布上基于每个'
|
||||
var canvas = new fabric.Canvas('canvas');
|
||||
var stage = new Konva.Stage({
|
||||
container: document.getElementById('container'),
|
||||
width: 600,
|
||||
height: 600,
|
||||
});
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
var pat=getArcPath(300, 100, 0);
|
||||
var fabricText = new fabric.Text(s, {
|
||||
fontSize: 22,
|
||||
fontFamily: 'Arial',
|
||||
top: 100,
|
||||
left: 200,
|
||||
//textAlign: 'center',
|
||||
pathAlign: 'center',
|
||||
charSpacing: 50,
|
||||
path: new fabric.Path(pat, {
|
||||
strokeWidth: 2,
|
||||
fill: null,
|
||||
stroke: '#ff0000',
|
||||
visible: true
|
||||
})
|
||||
});
|
||||
canvas.add(fabricText);
|
||||
|
||||
var txt = new Konva.TextPath({
|
||||
x: 100, y: 200,
|
||||
draggable: true,
|
||||
fill: '#333',
|
||||
fontSize: 22,
|
||||
fontFamily: 'Arial',
|
||||
text: s,
|
||||
//align: 'center',
|
||||
//textBaseline: "top",
|
||||
// letterSpacing: 5,
|
||||
data: pat
|
||||
});
|
||||
|
||||
layer.add(txt);
|
||||
const path = new Konva.Path({
|
||||
x: txt.x(),
|
||||
y: txt.y(),
|
||||
data: txt.data(),
|
||||
stroke: 'red'
|
||||
});
|
||||
layer.add(path);
|
||||
document.querySelector("#path").innerHTML=pat;
|
||||
|
||||
for (let e of document.querySelectorAll('input[type="range"]')) {
|
||||
e.addEventListener('input', () => {
|
||||
|
||||
let r = 650 - Math.abs(parseFloat(e.value) * 6);
|
||||
let l = getTextWidth(txt) + 50;
|
||||
|
||||
let d = getArcPath(l, r, parseFloat(e.value) > 0 ? 0 : 1)
|
||||
|
||||
document.querySelector("#path").innerHTML=d;
|
||||
|
||||
txt.data(d);
|
||||
path.data(txt.data())
|
||||
|
||||
fabricText.set("path",
|
||||
new fabric.Path(d, {
|
||||
strokeWidth: 1,
|
||||
stroke: '#ff0000',
|
||||
fill: null,
|
||||
visible: true
|
||||
})
|
||||
)
|
||||
canvas.renderAll();
|
||||
});
|
||||
}
|
||||
|
||||
function getArcPath(l, r, sweepFlag) {
|
||||
const upc = true;
|
||||
|
||||
const n = (l / (2 * Math.PI * r)) * (Math.PI * 2);
|
||||
const n2 = n / 2;
|
||||
const largeArcFlag = n > Math.PI ? 1 : 0;
|
||||
|
||||
//js math. sin /cos 用的是弧度不是角度
|
||||
const ax = Math.abs(r * Math.sin(n2));
|
||||
const ay = Math.abs(r * Math.cos(n2));
|
||||
|
||||
let x1, y1, x2, y2;
|
||||
x1 = r - ax;
|
||||
x2 = r + ax;
|
||||
if (n > 180) {
|
||||
if (upc)
|
||||
y1 = y2 = r + ay;
|
||||
else
|
||||
y1 = y2 = r - ay;
|
||||
} else if (n == 180) {
|
||||
x1 = 0;
|
||||
y1 = 0;
|
||||
x2 = r * 2;
|
||||
y2 = 0;
|
||||
} else {
|
||||
if (upc)
|
||||
y1 = y2 = r - ay;
|
||||
else
|
||||
y1 = y2 = r + ay;
|
||||
}
|
||||
x2 -= x1, y2 -= y1, x1 = 0, y1 = 0;
|
||||
|
||||
return `M${x1},${y1} A${r},${r} 0 ${largeArcFlag},${sweepFlag} ${x2},${y2}`
|
||||
}
|
||||
|
||||
rect.on('dbltap tap', (e) => {
|
||||
console.log(e.type);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -73,8 +73,7 @@ describe('TextPath', function () {
|
||||
fill: '#333',
|
||||
fontSize: 50,
|
||||
fontFamily: 'Arial',
|
||||
text:
|
||||
"All mhe world's a smage, and all mhe men and women merely players.",
|
||||
text: "All mhe world's a smage, and all mhe men and women merely players.",
|
||||
data: c,
|
||||
});
|
||||
|
||||
@ -185,8 +184,7 @@ describe('TextPath', function () {
|
||||
fill: 'orange',
|
||||
fontSize: 8,
|
||||
fontFamily: 'Arial',
|
||||
text:
|
||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||
text: "All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||
data: c,
|
||||
});
|
||||
|
||||
@ -216,8 +214,7 @@ describe('TextPath', function () {
|
||||
var textpath = new Konva.TextPath({
|
||||
fill: 'black',
|
||||
fontSize: 10,
|
||||
text:
|
||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||
text: "All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||
data: c,
|
||||
});
|
||||
|
||||
@ -270,8 +267,7 @@ describe('TextPath', function () {
|
||||
fill: 'orange',
|
||||
fontSize: 10,
|
||||
fontFamily: 'Arial',
|
||||
text:
|
||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||
text: "All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||
data: c,
|
||||
draggable: true,
|
||||
});
|
||||
@ -297,8 +293,7 @@ describe('TextPath', function () {
|
||||
fontSize: 10,
|
||||
fontFamily: 'Arial',
|
||||
letterSpacing: 5,
|
||||
text:
|
||||
"All the world's a stage, and all the men and women merely players.",
|
||||
text: "All the world's a stage, and all the men and women merely players.",
|
||||
data: c,
|
||||
});
|
||||
|
||||
@ -665,8 +660,7 @@ describe('TextPath', function () {
|
||||
text: 'Hello World',
|
||||
align: 'center',
|
||||
textBaseline: 'bottom',
|
||||
data:
|
||||
'M -80.34441853748636 -247.27469423673992 A 260 260 0 0 1 80.34441853748628 -247.27469423673995',
|
||||
data: 'M -80.34441853748636 -247.27469423673992 A 260 260 0 0 1 80.34441853748628 -247.27469423673995',
|
||||
})
|
||||
);
|
||||
|
||||
@ -680,8 +674,7 @@ describe('TextPath', function () {
|
||||
text: 'Hello World',
|
||||
align: 'center',
|
||||
// textBaseline: 'bottom',
|
||||
data:
|
||||
'M -80.34441853748636 -247.27469423673992 A 260 260 0 0 1 80.34441853748628 -247.27469423673995',
|
||||
data: 'M -80.34441853748636 -247.27469423673992 A 260 260 0 0 1 80.34441853748628 -247.27469423673995',
|
||||
})
|
||||
);
|
||||
|
||||
@ -747,18 +740,15 @@ describe('TextPath', function () {
|
||||
fontSize: 16,
|
||||
scaleX: 0.8,
|
||||
scaleY: 0.8,
|
||||
text:
|
||||
'__________________________________________________________________________________________________________________________________________________________________________________________________________________',
|
||||
data:
|
||||
'M 109.98618090452261 138.6656132223618 C 135.94577638190955 48.80547503140701 149.91187876884422 79.79800957914573 151.40954773869348 117.23973382537689 S 123.00811620603017 419.616741991206 122.84170854271358 460.0538041771357 S 134.33883542713568 469.8304329459799 149.98115577889448 464.33898005653265 S 245.4620163316583 411.5856081972362 257.1105527638191 412.91686950376885 S 239.31850251256282 474.434854428392 249.96859296482413 475.76611573492465 S 338.21036306532665 425.67526648869347 348.5276381909548 424.3440051821608 S 337.3640408291457 461.1772344535176 338.5288944723618 464.33898005653265 S 346.8778454773869 466.79295744346734 358.52638190954775 451.4834524183417',
|
||||
text: '__________________________________________________________________________________________________________________________________________________________________________________________________________________',
|
||||
data: 'M 109.98618090452261 138.6656132223618 C 135.94577638190955 48.80547503140701 149.91187876884422 79.79800957914573 151.40954773869348 117.23973382537689 S 123.00811620603017 419.616741991206 122.84170854271358 460.0538041771357 S 134.33883542713568 469.8304329459799 149.98115577889448 464.33898005653265 S 245.4620163316583 411.5856081972362 257.1105527638191 412.91686950376885 S 239.31850251256282 474.434854428392 249.96859296482413 475.76611573492465 S 338.21036306532665 425.67526648869347 348.5276381909548 424.3440051821608 S 337.3640408291457 461.1772344535176 338.5288944723618 464.33898005653265 S 346.8778454773869 466.79295744346734 358.52638190954775 451.4834524183417',
|
||||
});
|
||||
layer.add(textpath);
|
||||
var path = new Konva.Path({
|
||||
stroke: 'red',
|
||||
scaleX: 0.8,
|
||||
scaleY: 0.8,
|
||||
data:
|
||||
'M 109.98618090452261 138.6656132223618 C 135.94577638190955 48.80547503140701 149.91187876884422 79.79800957914573 151.40954773869348 117.23973382537689 S 123.00811620603017 419.616741991206 122.84170854271358 460.0538041771357 S 134.33883542713568 469.8304329459799 149.98115577889448 464.33898005653265 S 245.4620163316583 411.5856081972362 257.1105527638191 412.91686950376885 S 239.31850251256282 474.434854428392 249.96859296482413 475.76611573492465 S 338.21036306532665 425.67526648869347 348.5276381909548 424.3440051821608 S 337.3640408291457 461.1772344535176 338.5288944723618 464.33898005653265 S 346.8778454773869 466.79295744346734 358.52638190954775 451.4834524183417',
|
||||
data: 'M 109.98618090452261 138.6656132223618 C 135.94577638190955 48.80547503140701 149.91187876884422 79.79800957914573 151.40954773869348 117.23973382537689 S 123.00811620603017 419.616741991206 122.84170854271358 460.0538041771357 S 134.33883542713568 469.8304329459799 149.98115577889448 464.33898005653265 S 245.4620163316583 411.5856081972362 257.1105527638191 412.91686950376885 S 239.31850251256282 474.434854428392 249.96859296482413 475.76611573492465 S 338.21036306532665 425.67526648869347 348.5276381909548 424.3440051821608 S 337.3640408291457 461.1772344535176 338.5288944723618 464.33898005653265 S 346.8778454773869 466.79295744346734 358.52638190954775 451.4834524183417',
|
||||
});
|
||||
layer.add(path);
|
||||
layer.draw();
|
||||
@ -792,10 +782,8 @@ describe('TextPath', function () {
|
||||
stroke: 'black',
|
||||
scaleX: 0.4,
|
||||
scaleY: 0.4,
|
||||
text:
|
||||
'....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................',
|
||||
data:
|
||||
'M 117.12814070351759 108.66938206658291 C 79.18719346733668 277.73956799623113 75.85761180904522 379.96743797110554 82.84673366834171 395.7761659861809 S 148.83130025125627 280.47708118718595 177.12060301507537 244.36661824748745 S 326.1725898241206 61.02036887562815 325.67336683417085 85.815110709799 S 174.998726758794 435.7304316896985 172.8354271356784 457.1970202575377 S 273.65633103015074 310.01551271984926 307.1042713567839 270.07767352386935 S 466.09929459798997 92.08432302135678 459.9422110552764 114.3829499057789 S 266.23512060301505 435.5226006595478 254.2537688442211 461.4821961369347 S 328.1430565326633 368.1639210113065 357.09798994974875 337.2120956344221 S 486.31961118090453 207.61623570979899 502.79396984924625 195.8012916143216 S 511.48859170854274 200.85065719221106 498.50879396984925 235.79626648869348 S 379.73086055276383 489.4401119660804 391.37939698492465 495.76360317211055 S 573.2022663316583 313.03941849874377 598.4962311557789 290.0751609610553 S 608.3285672110553 288.6610529208543 608.4949748743719 298.64551271984925 S 604.9168530150754 352.64801334799 599.9246231155779 375.778678548995 S 540.6820665829146 508.5077162374372 565.643216080402 497.19199513190955 S 690.3761155778894 408.77881799623117 814.1834170854271 278.6480252826633',
|
||||
text: '....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................',
|
||||
data: 'M 117.12814070351759 108.66938206658291 C 79.18719346733668 277.73956799623113 75.85761180904522 379.96743797110554 82.84673366834171 395.7761659861809 S 148.83130025125627 280.47708118718595 177.12060301507537 244.36661824748745 S 326.1725898241206 61.02036887562815 325.67336683417085 85.815110709799 S 174.998726758794 435.7304316896985 172.8354271356784 457.1970202575377 S 273.65633103015074 310.01551271984926 307.1042713567839 270.07767352386935 S 466.09929459798997 92.08432302135678 459.9422110552764 114.3829499057789 S 266.23512060301505 435.5226006595478 254.2537688442211 461.4821961369347 S 328.1430565326633 368.1639210113065 357.09798994974875 337.2120956344221 S 486.31961118090453 207.61623570979899 502.79396984924625 195.8012916143216 S 511.48859170854274 200.85065719221106 498.50879396984925 235.79626648869348 S 379.73086055276383 489.4401119660804 391.37939698492465 495.76360317211055 S 573.2022663316583 313.03941849874377 598.4962311557789 290.0751609610553 S 608.3285672110553 288.6610529208543 608.4949748743719 298.64551271984925 S 604.9168530150754 352.64801334799 599.9246231155779 375.778678548995 S 540.6820665829146 508.5077162374372 565.643216080402 497.19199513190955 S 690.3761155778894 408.77881799623117 814.1834170854271 278.6480252826633',
|
||||
});
|
||||
var path = new Konva.Path({
|
||||
x: 0,
|
||||
@ -803,8 +791,7 @@ describe('TextPath', function () {
|
||||
stroke: 'red',
|
||||
scaleX: 0.4,
|
||||
scaleY: 0.4,
|
||||
data:
|
||||
'M 117.12814070351759 108.66938206658291 C 79.18719346733668 277.73956799623113 75.85761180904522 379.96743797110554 82.84673366834171 395.7761659861809 S 148.83130025125627 280.47708118718595 177.12060301507537 244.36661824748745 S 326.1725898241206 61.02036887562815 325.67336683417085 85.815110709799 S 174.998726758794 435.7304316896985 172.8354271356784 457.1970202575377 S 273.65633103015074 310.01551271984926 307.1042713567839 270.07767352386935 S 466.09929459798997 92.08432302135678 459.9422110552764 114.3829499057789 S 266.23512060301505 435.5226006595478 254.2537688442211 461.4821961369347 S 328.1430565326633 368.1639210113065 357.09798994974875 337.2120956344221 S 486.31961118090453 207.61623570979899 502.79396984924625 195.8012916143216 S 511.48859170854274 200.85065719221106 498.50879396984925 235.79626648869348 S 379.73086055276383 489.4401119660804 391.37939698492465 495.76360317211055 S 573.2022663316583 313.03941849874377 598.4962311557789 290.0751609610553 S 608.3285672110553 288.6610529208543 608.4949748743719 298.64551271984925 S 604.9168530150754 352.64801334799 599.9246231155779 375.778678548995 S 540.6820665829146 508.5077162374372 565.643216080402 497.19199513190955 S 690.3761155778894 408.77881799623117 814.1834170854271 278.6480252826633',
|
||||
data: 'M 117.12814070351759 108.66938206658291 C 79.18719346733668 277.73956799623113 75.85761180904522 379.96743797110554 82.84673366834171 395.7761659861809 S 148.83130025125627 280.47708118718595 177.12060301507537 244.36661824748745 S 326.1725898241206 61.02036887562815 325.67336683417085 85.815110709799 S 174.998726758794 435.7304316896985 172.8354271356784 457.1970202575377 S 273.65633103015074 310.01551271984926 307.1042713567839 270.07767352386935 S 466.09929459798997 92.08432302135678 459.9422110552764 114.3829499057789 S 266.23512060301505 435.5226006595478 254.2537688442211 461.4821961369347 S 328.1430565326633 368.1639210113065 357.09798994974875 337.2120956344221 S 486.31961118090453 207.61623570979899 502.79396984924625 195.8012916143216 S 511.48859170854274 200.85065719221106 498.50879396984925 235.79626648869348 S 379.73086055276383 489.4401119660804 391.37939698492465 495.76360317211055 S 573.2022663316583 313.03941849874377 598.4962311557789 290.0751609610553 S 608.3285672110553 288.6610529208543 608.4949748743719 298.64551271984925 S 604.9168530150754 352.64801334799 599.9246231155779 375.778678548995 S 540.6820665829146 508.5077162374372 565.643216080402 497.19199513190955 S 690.3761155778894 408.77881799623117 814.1834170854271 278.6480252826633',
|
||||
});
|
||||
layer.add(path);
|
||||
// emulate different size function:
|
||||
@ -822,4 +809,28 @@ describe('TextPath', function () {
|
||||
assert.equal(Math.round(rect.width), 299);
|
||||
assert.equal(Math.round(rect.height), 171);
|
||||
});
|
||||
|
||||
it.skip('check vertical text path', function () {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
var textpath = new Konva.TextPath({
|
||||
x: -280,
|
||||
y: -190,
|
||||
fill: 'black',
|
||||
fontSize: 10,
|
||||
fontFamily: 'Arial',
|
||||
align: 'right',
|
||||
text: '&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&',
|
||||
data: 'M 283 383 L 283 187',
|
||||
});
|
||||
layer.add(textpath);
|
||||
layer.draw();
|
||||
|
||||
var rect = textpath.getClientRect();
|
||||
|
||||
assert.equal(rect.height, 200, 'check height');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user