fix wrong Path getClientRect() calculation

This commit is contained in:
Anton Lavrenov 2016-02-05 06:51:26 +08:00
parent e3596d6c63
commit e54b378a33
5 changed files with 48 additions and 31 deletions

View File

@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## Fixed
- repair `cancelBubble` event property behaviour
- fix wrong `Path` `getClientRect()` calculation
## [0.11.1][2016-01-16]

View File

@ -3,7 +3,7 @@
* Konva JavaScript Framework v0.11.1
* http://konvajs.github.io/
* Licensed under the MIT or GPL Version 2 licenses.
* Date: Tue Jan 26 2016
* Date: Fri Feb 05 2016
*
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
* Modified work Copyright (C) 2014 - 2015 by Anton Lavrenov (Konva)
@ -14157,8 +14157,8 @@
});
var minX = points[0];
var maxX = points[0];
var minY = points[0];
var maxY = points[0];
var minY = points[1];
var maxY = points[1];
var x, y;
for (var i = 0; i < points.length / 2; i++) {
x = points[i * 2]; y = points[i * 2 + 1];

4
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -99,8 +99,8 @@
});
var minX = points[0];
var maxX = points[0];
var minY = points[0];
var maxY = points[0];
var minY = points[1];
var maxY = points[1];
var x, y;
for (var i = 0; i < points.length / 2; i++) {
x = points[i * 2]; y = points[i * 2 + 1];

View File

@ -869,4 +869,20 @@ suite('Path', function() {
assert.equal(hitTrace, 'clearRect(0,0,578,200);save();transform(1,0,0,1,0,0);beginPath();moveTo(50,0);bezierCurveTo(50,150,170,170,200,170);lineWidth=2;strokeStyle=black;stroke();restore();');
});
it('getClientRect', function() {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var path = new Konva.Path({
data: 'M61.55,184.55 60.55,280.55 164.55,284.55 151.55,192.55 Z',
fill: 'black',
stroke: 'red'
});
layer.add(path);
var rect = path.getClientRect();
assert.deepEqual(rect, {x: 60, y: 184, width: 106, height: 102});
})
});