Comparing version 1.7.9 to 1.7.10
@@ -0,1 +1,14 @@ | ||
**Version 1.7.10** | ||
- Fix: correct svg export for radial gradients [#3807](https://github.com/kangax/fabric.js/pull/3807) | ||
- Fix: Update fireout events to export the event object [#3853](https://github.com/kangax/fabric.js/pull/3853) | ||
- Fix: Improve callSuper to avoid infinite loops (not all of them) [#3844](https://github.com/kangax/fabric.js/pull/3844) | ||
- Fix: avoid selectionBackgroundColor leak on toDataUrl [#3862](https://github.com/kangax/fabric.js/pull/3862) | ||
- Fix: toDatelessObject for Group [#3863](https://github.com/kangax/fabric.js/pull/3863) | ||
- Improvement: better caching logic for groups [#3864](https://github.com/kangax/fabric.js/pull/3864) | ||
- Fix: correct svg gradient export for radial in polygons [#3866](https://github.com/kangax/fabric.js/pull/3866) | ||
- Fix: First draw could be empty for some objects [#3870](https://github.com/kangax/fabric.js/pull/3870) | ||
- Fix: Always send event data to object:selected [#3871](https://github.com/kangax/fabric.js/pull/3871) | ||
- Improvement: reduce angle calculation error [#3872](https://github.com/kangax/fabric.js/pull/3872) | ||
**Version 1.7.9** | ||
@@ -2,0 +15,0 @@ |
@@ -28,3 +28,3 @@ <!-- | ||
## Version | ||
1.7.8 | ||
1.7.10 | ||
@@ -31,0 +31,0 @@ ## Test Case |
@@ -5,3 +5,3 @@ { | ||
"homepage": "http://fabricjs.com/", | ||
"version": "1.7.9", | ||
"version": "1.7.10", | ||
"author": "Juriy Zaytsev <kangax@gmail.com>", | ||
@@ -8,0 +8,0 @@ "contributors": [ |
@@ -39,2 +39,43 @@ (function() { | ||
function createRadialGradientWithInternalRadius() { | ||
return new fabric.Gradient({ | ||
type: 'radial', | ||
coords: { | ||
x1: 0, | ||
y1: 10, | ||
x2: 100, | ||
y2: 200, | ||
r1: 10, | ||
r2: 50 | ||
}, | ||
colorStops: [ | ||
{ offset: 0, color: 'red' }, | ||
{ offset: 1, color: 'green', opacity: 0 } | ||
] | ||
}); | ||
} | ||
function createRadialGradientSwapped() { | ||
return new fabric.Gradient({ | ||
type: 'radial', | ||
coords: { | ||
x1: 0, | ||
y1: 10, | ||
x2: 100, | ||
y2: 200, | ||
r1: 50, | ||
r2: 10 | ||
}, | ||
colorStops: [ | ||
{ offset: 0, color: 'red' }, | ||
{ offset: 1, color: 'green', opacity: 0 } | ||
] | ||
}); | ||
} | ||
var SVG_LINEAR = '<linearGradient id="SVGID_0" gradientUnits="userSpaceOnUse" x1="-50" y1="-40" x2="50" y2="150">\n<stop offset="0%" style="stop-color:red;stop-opacity: 0"/>\n<stop offset="100%" style="stop-color:green;stop-opacity: undefined"/>\n</linearGradient>\n'; | ||
var SVG_RADIAL = '<radialGradient id="SVGID_0" gradientUnits="userSpaceOnUse" cx="50" cy="150" r="50" fx="-50" fy="-40">\n<stop offset="0%" style="stop-color:red;stop-opacity: undefined"/>\n<stop offset="100%" style="stop-color:green;stop-opacity: 0"/>\n</radialGradient>\n'; | ||
var SVG_INTERNALRADIUS = '<radialGradient id="SVGID_0" gradientUnits="userSpaceOnUse" cx="50" cy="150" r="50" fx="-50" fy="-40">\n<stop offset="20%" style="stop-color:red;stop-opacity: undefined"/>\n<stop offset="100%" style="stop-color:green;stop-opacity: 0"/>\n</radialGradient>\n'; | ||
var SVG_SWAPPED = '<radialGradient id="SVGID_0" gradientUnits="userSpaceOnUse" cx="-50" cy="-40" r="50" fx="50" fy="150">\n<stop offset="20%" style="stop-color:green;stop-opacity: 0"/>\n<stop offset="100%" style="stop-color:red;stop-opacity: undefined"/>\n</radialGradient>\n'; | ||
test('constructor linearGradient', function() { | ||
@@ -638,8 +679,33 @@ ok(fabric.Gradient); | ||
var gradient = createLinearGradient(); | ||
ok(typeof gradient.toSVG == 'function'); | ||
}); | ||
// TODO: test toSVG | ||
test('toSVG linear', function() { | ||
fabric.Object.__uid = 0; | ||
var gradient = createLinearGradient(); | ||
var obj = new fabric.Object({ width: 100, height: 100 }); | ||
equal(gradient.toSVG(obj), SVG_LINEAR); | ||
}); | ||
test('toSVG radial', function() { | ||
fabric.Object.__uid = 0; | ||
var gradient = createRadialGradient(); | ||
var obj = new fabric.Object({ width: 100, height: 100 }); | ||
equal(gradient.toSVG(obj), SVG_RADIAL); | ||
}); | ||
test('toSVG radial with r1 > 0', function() { | ||
fabric.Object.__uid = 0; | ||
var gradient = createRadialGradientWithInternalRadius(); | ||
var obj = new fabric.Object({ width: 100, height: 100 }); | ||
equal(gradient.toSVG(obj), SVG_INTERNALRADIUS); | ||
}); | ||
test('toSVG radial with r1 > 0', function() { | ||
fabric.Object.__uid = 0; | ||
var gradient = createRadialGradientSwapped(); | ||
var obj = new fabric.Object({ width: 100, height: 100 }); | ||
equal(gradient.toSVG(obj), SVG_SWAPPED); | ||
}); | ||
})(); |
@@ -593,2 +593,59 @@ (function() { | ||
}); | ||
test('group toDatalessObject', function() { | ||
var rect1 = new fabric.Rect({ top: 1, left: 1, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}), | ||
rect2 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}), | ||
pathGroup = new fabric.PathGroup([rect1, rect2], { sourcePath: 'sourcePath'}), | ||
group = new fabric.Group([pathGroup]), | ||
dataless = group.toDatalessObject(); | ||
equal(dataless.objects[0].paths, 'sourcePath', 'the paths have been changed with the sourcePath'); | ||
}); | ||
test('group willDrawShadow', function() { | ||
var rect1 = new fabric.Rect({ top: 1, left: 1, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}), | ||
rect2 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}), | ||
rect3 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}), | ||
rect4 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}), | ||
group = new fabric.Group([rect1, rect2]), | ||
group2 = new fabric.Group([rect3, rect4]), | ||
group3 = new fabric.Group([group, group2]); | ||
equal(group3.willDrawShadow(), false, 'group will not cast shadow because objects do not have it'); | ||
group3.shadow = {}; | ||
equal(group3.willDrawShadow(), true, 'group will cast shadow because group itself has shadow'); | ||
delete group3.shadow; | ||
group2.shadow = {}; | ||
equal(group3.willDrawShadow(), true, 'group will cast shadow because inner group2 has shadow'); | ||
delete group2.shadow; | ||
rect1.shadow = {}; | ||
equal(group3.willDrawShadow(), true, 'group will cast shadow because inner rect1 has shadow'); | ||
equal(group.willDrawShadow(), true, 'group will cast shadow because inner rect1 has shadow'); | ||
equal(group2.willDrawShadow(), false, 'group will not cast shadow because no child has shadow'); | ||
}); | ||
test('group shouldCache', function() { | ||
var rect1 = new fabric.Rect({ top: 1, left: 1, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: true}), | ||
rect2 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: true}), | ||
rect3 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: true}), | ||
rect4 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: true}), | ||
group = new fabric.Group([rect1, rect2], { objectCaching: true}), | ||
group2 = new fabric.Group([rect3, rect4], { objectCaching: true}), | ||
group3 = new fabric.Group([group, group2], { objectCaching: true}); | ||
equal(group3.shouldCache(), true, 'group3 will cache because no child has shadow'); | ||
equal(group2.shouldCache(), false, 'group2 will not cache because is drawing on parent group3 cache'); | ||
equal(rect3.shouldCache(), false, 'rect3 will not cache because is drawing on parent2 group cache'); | ||
group2.shadow = {}; | ||
rect1.shadow = {}; | ||
equal(group3.shouldCache(), false, 'group3 will cache because children have shadow'); | ||
equal(group2.shouldCache(), true, 'group2 will cache because is not drawing on parent group3 cache and no children have shadow'); | ||
equal(group.shouldCache(), false, 'group will not cache because even if is not drawing on parent group3 cache children have shadow'); | ||
equal(rect1.shouldCache(), true, 'rect1 will cache because none of its parent is caching'); | ||
equal(rect3.shouldCache(), false, 'rect3 will not cache because group2 is caching'); | ||
}); | ||
// asyncTest('cloning group with image', function() { | ||
@@ -595,0 +652,0 @@ // var rect = new fabric.Rect({ top: 100, left: 100, width: 30, height: 10 }), |
@@ -152,12 +152,2 @@ (function(){ | ||
test('setSourcePath', function() { | ||
var cObj = new fabric.Object(); | ||
var SRC_PATH = 'http://example.com/'; | ||
ok(typeof cObj.setSourcePath == 'function'); | ||
cObj.setSourcePath(SRC_PATH); | ||
equal(cObj.get('sourcePath'), SRC_PATH); | ||
}); | ||
test('stateProperties', function() { | ||
@@ -1264,2 +1254,3 @@ var cObj = new fabric.Object(); | ||
var object = new fabric.Object({ scaleX: 3, scaleY: 2}); | ||
equal(object.dirty, true, 'object is dirty after creation'); | ||
object.cacheProperties = ['propA', 'propB']; | ||
@@ -1282,2 +1273,4 @@ object.dirty = false; | ||
object._createCacheCanvas(); | ||
equal(object.isCacheDirty(), true, 'object is dirty if canvas has been just created'); | ||
object.setupState({ propertySet: 'cacheProperties' }); | ||
equal(object.isCacheDirty(), false, 'object is not dirty'); | ||
@@ -1284,0 +1277,0 @@ object.propA = 'B'; |
@@ -169,3 +169,3 @@ (function(){ | ||
pathGroup.setSourcePath('http://example.com/'); | ||
pathGroup.sourcePath = 'http://example.com/'; | ||
var expectedObject = fabric.util.object.extend(fabric.util.object.clone(REFERENCE_PATH_GROUP_OBJECT), { | ||
@@ -172,0 +172,0 @@ 'paths': 'http://example.com/', |
@@ -143,3 +143,3 @@ (function() { | ||
var src = 'http://example.com/'; | ||
path.setSourcePath(src); | ||
path.sourcePath = src; | ||
deepEqual(path.toDatalessObject(), fabric.util.object.extend(fabric.util.object.clone(REFERENCE_PATH_OBJECT), { | ||
@@ -146,0 +146,0 @@ path: src |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
11284919
56619