mirror of
https://github.com/konvajs/konva.git
synced 2025-11-24 08:46:44 +08:00
fix arrow.getClientRect() calculations. fix #1851
This commit is contained in:
@@ -229,4 +229,33 @@ describe('Arrow', function () {
|
||||
|
||||
cloneAndCompareLayer(layer, 255, 50);
|
||||
});
|
||||
|
||||
it('getClientRect', function () {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
|
||||
var arrow = new Konva.Arrow({
|
||||
points: [50, 50, 150, 50],
|
||||
stroke: 'blue',
|
||||
fill: 'blue',
|
||||
// large stroke width will not work :(
|
||||
strokeWidth: 1,
|
||||
draggable: true,
|
||||
tension: 0,
|
||||
pointerLength: 10,
|
||||
pointerWidth: 20,
|
||||
});
|
||||
layer.add(arrow);
|
||||
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
var rect = arrow.getClientRect({ skipStroke: true });
|
||||
layer.add(new Konva.Rect({...rect, stroke: 'red' }));
|
||||
|
||||
assert.equal(rect.x, 50);
|
||||
assert.equal(rect.y, 40);
|
||||
assert.equal(rect.width, 100);
|
||||
assert.equal(rect.height, 20);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -741,7 +741,7 @@ describe('Text', function () {
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
it.only('text multi line with justify align and decoration', function () {
|
||||
it('text multi line with justify align and decoration', function () {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user