mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-17 10:01:08 +00:00
Fix path shifting and inability to draw dots on 1.7 (#4525)
* fix paths * fixed tests * restored dist * right limit
This commit is contained in:
parent
056e7008d3
commit
84f5e5abe3
3 changed files with 11 additions and 7 deletions
|
|
@ -146,7 +146,7 @@
|
|||
var path = [], i, width = this.width / 1000,
|
||||
p1 = new fabric.Point(points[0].x, points[0].y),
|
||||
p2 = new fabric.Point(points[1].x, points[1].y),
|
||||
len = points.length, multSignX, multSignY, manyPoints = len > 2;
|
||||
len = points.length, multSignX = 1, multSignY = 1, manyPoints = len > 2;
|
||||
|
||||
if (manyPoints) {
|
||||
multSignX = points[2].x < p2.x ? -1 : points[2].x === p2.x ? 0 : 1;
|
||||
|
|
@ -187,9 +187,14 @@
|
|||
strokeLineCap: this.strokeLineCap,
|
||||
strokeLineJoin: this.strokeLineJoin,
|
||||
strokeDashArray: this.strokeDashArray,
|
||||
originX: 'center',
|
||||
originY: 'center'
|
||||
});
|
||||
var position = new fabric.Point(path.left + path.width / 2, path.top + path.height / 2);
|
||||
position = path.translateToGivenOrigin(position, 'center', 'center', path.originX, path.originY);
|
||||
var position = new fabric.Point(path.left, path.top);
|
||||
path.originX = fabric.Object.prototype.originX;
|
||||
path.originY = fabric.Object.prototype.originY;
|
||||
position = path.translateToGivenOrigin(
|
||||
position, 'center', 'center', path.originX, path.originY);
|
||||
path.top = position.y;
|
||||
path.left = position.x;
|
||||
if (this.shadow) {
|
||||
|
|
|
|||
|
|
@ -417,7 +417,6 @@
|
|||
var groupObject = group.toObject();
|
||||
|
||||
fabric.Group.fromObject(groupObject, function(newGroupFromObject) {
|
||||
console.log(newGroupFromObject._objects[0]);
|
||||
ok(newGroupFromObject._objects[0].oCoords.tl, 'acoords 0 are restored');
|
||||
ok(newGroupFromObject._objects[1].oCoords.tl, 'acoords 1 are restored');
|
||||
|
||||
|
|
|
|||
|
|
@ -1228,7 +1228,7 @@
|
|||
});
|
||||
|
||||
test('_limitCacheSize limit min to 256', function() {
|
||||
fabric.perfLimitSizeTotal = 10000;
|
||||
fabric.perfLimitSizeTotal = 60000;
|
||||
fabric.maxCacheSideLimit = 4096;
|
||||
fabric.minCacheSideLimit = 256;
|
||||
var object = new fabric.Object({ width: 200, height: 200, strokeWidth: 0 });
|
||||
|
|
@ -1237,8 +1237,8 @@
|
|||
var zoomY = dims.zoomY;
|
||||
var limitedDims = object._limitCacheSize(dims);
|
||||
equal(dims, limitedDims, 'object is mutated');
|
||||
equal(dims.width, 256, 'width gets minimum to the cacheSideLimit');
|
||||
equal(dims.height, 256, 'height gets minimum to the cacheSideLimit');
|
||||
equal(limitedDims.width, 256, 'width gets minimum to the cacheSideLimit');
|
||||
equal(limitedDims.height, 256, 'height gets minimum to the cacheSideLimit');
|
||||
equal(zoomX, dims.zoomX, 'zoom factor X does not need a change');
|
||||
equal(zoomY, dims.zoomY, 'zoom factor Y does not need a change');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue