Comparing version 1.6.0 to 1.6.1
@@ -0,1 +1,18 @@ | ||
**Version 1.6.1** | ||
- Fix: image with broken element throwing error on toObject() [#2878](https://github.com/kangax/fabric.js/pull/2878) | ||
- Fix: Warning on trying to set proprietary browser version of ctxImageSmoothingEnabled [#2880](https://github.com/kangax/fabric.js/pull/2880) | ||
- Fix: Fixed Svg import regression on color and drawing polylines [#2887](https://github.com/kangax/fabric.js/pull/2887) | ||
- Fix: Fixed animation ease that starts and stop at same value [#2888](https://github.com/kangax/fabric.js/pull/2888) | ||
- Fix: Allow a not stateful canvas to fire object:modified at end of transform. [#2890](https://github.com/kangax/fabric.js/pull/2890) | ||
- Fix: Made event handler removal safer. Removing firing events will not cause errors. [#2883](https://github.com/kangax/fabric.js/pull/2883) | ||
- Fix: Proper handling of perPixelTargetFind and multi selections [#2894](https://github.com/kangax/fabric.js/pull/2894) | ||
- Fix: Do not clear contextTop on drawingMode, to allow drawing over animations [#2895](https://github.com/kangax/fabric.js/pull/2895) | ||
- Change the dependencies to optional. Allow npm to continue installing if nodecanvas installation fail.[#2901](https://github.com/kangax/fabric.js/pull/2901) | ||
- Fix: Check again the target on mouseup [#2902](https://github.com/kangax/fabric.js/pull/2902) | ||
- Fix: On perPixelTargetFind detect corners only if target is active [#2903](https://github.com/kangax/fabric.js/pull/2903) | ||
- Improvement: Add canvas mouseout event listener [#2907](https://github.com/kangax/fabric.js/pull/2907) | ||
- Improvement: Make small object draggable easier [#2907](https://github.com/kangax/fabric.js/pull/2907) | ||
- Improvement: Use sendToBack, bringToFront, bringForward, sendBackwards for multiple selections [#2908](https://github.com/kangax/fabric.js/pull/2908) | ||
**Version 1.6.0** | ||
@@ -64,3 +81,3 @@ | ||
BACK INCOMPATIBILITY: removed 'allOnTop' parameter from fabric.StaticCanvas.renderAll. | ||
- Fix mask filter, mask image is now streched on all image [#2543](https://github.com/kangax/fabric.js/pull/2487) | ||
- Fix mask filter, mask image is now streched on all image [#2543](https://github.com/kangax/fabric.js/pull/2543) | ||
- Fix text onInput event to behave correctly if some text is selected [#2501](https://github.com/kangax/fabric.js/pull/2502) | ||
@@ -67,0 +84,0 @@ - Fix object with selectable = false could be selected with shift click [#2503](https://github.com/kangax/fabric.js/pull/2503) |
var fs = require('fs'), | ||
execSync = require('execSync').exec; | ||
//execSync = require('execSync').exec; | ||
execSync = require('child_process').execSync; | ||
var modules = [ | ||
'text', | ||
'itext', | ||
'textbox', | ||
'animation', | ||
'gestures', | ||
@@ -7,0 +11,0 @@ 'easing', |
@@ -27,3 +27,3 @@ <!-- | ||
## Version | ||
1.6.0 | ||
1.6.1 | ||
@@ -30,0 +30,0 @@ ## Test Case |
@@ -5,3 +5,3 @@ { | ||
"homepage": "http://fabricjs.com/", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"author": "Juriy Zaytsev <kangax@gmail.com>", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"optionalDependencies": { | ||
"canvas": "1.3.x", | ||
@@ -48,4 +48,3 @@ "jsdom": "3.x.x", | ||
"devDependencies": { | ||
"execSync": "1.0.x", | ||
"uglify-js": "2.4.x", | ||
"uglify-js": "2.6.x", | ||
"jscs": "2.1.x", | ||
@@ -52,0 +51,0 @@ "jshint": "2.8.x", |
@@ -63,2 +63,7 @@ (function() { | ||
function makeTriangle(options) { | ||
var defaultOptions = { width: 10, height: 10 }; | ||
return new fabric.Triangle(fabric.util.object.extend(defaultOptions, options || { })); | ||
} | ||
QUnit.module('fabric.Canvas', { | ||
@@ -220,4 +225,131 @@ setup: function() { | ||
ok(typeof canvas.findTarget == 'function'); | ||
var rect = makeRect({ left: 0, top: 0 }), target; | ||
canvas.add(rect); | ||
target = canvas.findTarget({ | ||
clientX: 5, clientY: 5 | ||
}, true); | ||
equal(target, rect, 'Should return the rect'); | ||
target = canvas.findTarget({ | ||
clientX: 30, clientY: 30 | ||
}, true); | ||
equal(target, null, 'Should not find target'); | ||
canvas.remove(rect); | ||
}); | ||
test('findTarget with perPixelTargetFind', function() { | ||
ok(typeof canvas.findTarget == 'function'); | ||
var triangle = makeTriangle({ left: 0, top: 0 }), target; | ||
canvas.add(triangle); | ||
target = canvas.findTarget({ | ||
clientX: 2, clientY: 1 | ||
}, true); | ||
equal(target, triangle, 'Should return the triangle by bounding box'); | ||
//TODO find out why this stops the tests | ||
//canvas.perPixelTargetFind = true; | ||
//target = canvas.findTarget({ | ||
// clientX: 2, clientY: 1 | ||
//}, true); | ||
//equal(target, null, 'Should return null because of transparency checks'); | ||
target = canvas.findTarget({ | ||
clientX: 5, clientY: 5 | ||
}, true); | ||
equal(target, triangle, 'Should return the triangle now'); | ||
canvas.perPixelTargetFind = false; | ||
canvas.remove(triangle); | ||
}); | ||
test('findTarget on activegroup', function() { | ||
var rect1 = makeRect({ left: 0, top: 0 }), target; | ||
var rect2 = makeRect({ left: 20, top: 0 }); | ||
canvas.add(rect1); | ||
canvas.add(rect2); | ||
var group = new fabric.Group([ rect1, rect2 ]); | ||
canvas.add(group); | ||
canvas.setActiveGroup(group); | ||
target = canvas.findTarget({ | ||
clientX: 5, clientY: 5 | ||
}, true); | ||
equal(target, group, 'Should return the activegroup'); | ||
//TODO: make it work with perPixelTargetFind | ||
}); | ||
test('activeGroup sendToBack', function() { | ||
var rect1 = makeRect(), | ||
rect2 = makeRect(), | ||
rect3 = makeRect(), | ||
rect4 = makeRect(); | ||
canvas.add(rect1, rect2, rect3, rect4); | ||
var group = new fabric.Group([ rect3, rect4 ]); | ||
canvas.setActiveGroup(group); | ||
equal(canvas._objects[0], rect1, 'rect1 should be last'); | ||
equal(canvas._objects[1], rect2, 'rect2 should be second'); | ||
canvas.sendToBack(group); | ||
equal(canvas._objects[0], rect3, 'rect3 should be the new last'); | ||
equal(canvas._objects[1], rect4, 'rect3 should be the new second'); | ||
equal(canvas._objects[2], rect1, 'rect1 should be the third object'); | ||
equal(canvas._objects[3], rect2, 'rect2 should be on top now'); | ||
}); | ||
test('activeGroup bringToFront', function() { | ||
var rect1 = makeRect(), | ||
rect2 = makeRect(), | ||
rect3 = makeRect(), | ||
rect4 = makeRect(); | ||
canvas.add(rect1, rect2, rect3, rect4); | ||
var group = new fabric.Group([ rect1, rect2 ]); | ||
canvas.setActiveGroup(group); | ||
equal(canvas._objects[0], rect1, 'rect1 should be last'); | ||
equal(canvas._objects[1], rect2, 'rect2 should be second'); | ||
canvas.bringToFront(group); | ||
equal(canvas._objects[0], rect3, 'rect3 should be the new last'); | ||
equal(canvas._objects[1], rect4, 'rect3 should be the new second'); | ||
equal(canvas._objects[2], rect1, 'rect1 should be the third object'); | ||
equal(canvas._objects[3], rect2, 'rect2 should be on top now'); | ||
}); | ||
test('activeGroup bringForward', function() { | ||
var rect1 = makeRect(), | ||
rect2 = makeRect(), | ||
rect3 = makeRect(), | ||
rect4 = makeRect(); | ||
canvas.add(rect1, rect2, rect3, rect4); | ||
var group = new fabric.Group([ rect1, rect2 ]); | ||
canvas.setActiveGroup(group); | ||
equal(canvas._objects[0], rect1, 'rect1 should be last'); | ||
equal(canvas._objects[1], rect2, 'rect2 should be second'); | ||
canvas.bringForward(group); | ||
equal(canvas._objects[0], rect3, 'rect3 should be the new last'); | ||
equal(canvas._objects[1], rect1, 'rect1 should be the new second'); | ||
equal(canvas._objects[2], rect2, 'rect2 should be the third object'); | ||
equal(canvas._objects[3], rect4, 'rect4 did not move'); | ||
}); | ||
test('activeGroup sendBackwards', function() { | ||
var rect1 = makeRect(), | ||
rect2 = makeRect(), | ||
rect3 = makeRect(), | ||
rect4 = makeRect(); | ||
canvas.add(rect1, rect2, rect3, rect4); | ||
var group = new fabric.Group([ rect3, rect4 ]); | ||
canvas.setActiveGroup(group); | ||
equal(canvas._objects[0], rect1, 'rect1 should be last'); | ||
equal(canvas._objects[1], rect2, 'rect2 should be second'); | ||
canvas.sendBackwards(group); | ||
equal(canvas._objects[0], rect1, 'rect1 is still last'); | ||
equal(canvas._objects[1], rect3, 'rect3 should be shifted down by 1'); | ||
equal(canvas._objects[2], rect4, 'rect4 should be shifted down by 1'); | ||
equal(canvas._objects[3], rect2, 'rect2 is the new top'); | ||
}); | ||
test('toDataURL', function() { | ||
@@ -237,23 +369,21 @@ ok(typeof canvas.toDataURL == 'function'); | ||
// asyncTest('getPointer', function() { | ||
// ok(typeof canvas.getPointer == 'function'); | ||
// asyncTest('getPointer', function() { | ||
// ok(typeof canvas.getPointer == 'function'); | ||
// | ||
// fabric.util.addListener(upperCanvasEl, 'click', function(e) { | ||
// canvas.calcOffset(); | ||
// var pointer = canvas.getPointer(e); | ||
// equal(pointer.x, 101, 'pointer.x should be correct'); | ||
// equal(pointer.y, 102, 'pointer.y should be correct'); | ||
// | ||
// start(); | ||
// }); | ||
// window.scroll(0, 0); | ||
// setTimeout(function() { | ||
// simulateEvent(upperCanvasEl, 'click', { | ||
// pointerX: 101, pointerY: 102 | ||
// }); | ||
// }, 100); | ||
// }); | ||
// fabric.util.addListener(upperCanvasEl, 'click', function(e) { | ||
// canvas.calcOffset(); | ||
// var pointer = canvas.getPointer(e); | ||
// equal(pointer.x, 101, 'pointer.x should be correct'); | ||
// equal(pointer.y, 102, 'pointer.y should be correct'); | ||
// start(); | ||
// }); | ||
// setTimeout(function() { | ||
// simulateEvent(upperCanvasEl, 'click', { | ||
// pointerX: 101, pointerY: 102 | ||
// }); | ||
// }, 100); | ||
// }); | ||
test('getCenter', function() { | ||
@@ -260,0 +390,0 @@ ok(typeof canvas.getCenter == 'function'); |
@@ -172,2 +172,105 @@ QUnit.module('fabric.Observable'); | ||
test('removal of past events', function() { | ||
var foo = { }, | ||
event1Fired = false, event2Fired = false, | ||
event3Fired = false, event4Fired = false, | ||
handler1 = function() { | ||
event1Fired = true; | ||
foo.off('bar:baz', handler1); | ||
}, | ||
handler2 = function() { | ||
event2Fired = true; | ||
}, | ||
handler3 = function() { | ||
event3Fired = true; | ||
}, | ||
handler4 = function() { | ||
event4Fired = true; | ||
}; | ||
fabric.util.object.extend(foo, fabric.Observable); | ||
foo.on('bar:baz', handler1); | ||
foo.on('bar:baz', handler2); | ||
foo.on('bar:baz', handler3); | ||
foo.on('bar:baz', handler4); | ||
equal(foo.__eventListeners['bar:baz'].length, 4, 'There should be 4 events registered now'); | ||
foo.trigger('bar:baz'); | ||
equal(foo.__eventListeners['bar:baz'].length, 3, 'There should be 3 events registered now'); | ||
equal(event1Fired, true, 'Event 1 should fire'); | ||
equal(event2Fired, true, 'Event 2 should fire'); | ||
equal(event3Fired, true, 'Event 3 should fire'); | ||
equal(event4Fired, true, 'Event 4 should fire'); | ||
}); | ||
test('removal of past events inner loop', function() { | ||
var foo = { }, | ||
event1Fired = 0, event2Fired = 0, | ||
event3Fired = 0, event4Fired = 0, | ||
handler1 = function() { | ||
event1Fired++; | ||
foo.off('bar:baz', handler1); | ||
equal(foo.__eventListeners['bar:baz'].length, 4, 'There should be still 4 handlers registered'); | ||
equal(event1Fired, 1, 'Event 1 should fire once'); | ||
equal(event2Fired, 0, 'Event 2 should not be fired yet'); | ||
equal(event3Fired, 0, 'Event 3 should not be fired yet'); | ||
equal(event4Fired, 0, 'Event 4 should not be fired yet'); | ||
foo.trigger('bar:baz'); | ||
equal(foo.__eventListeners['bar:baz'].length, 3, 'There should be 3 handlers registered now'); | ||
}, | ||
handler2 = function() { | ||
event2Fired++; | ||
}, | ||
handler3 = function() { | ||
event3Fired++; | ||
}, | ||
handler4 = function() { | ||
event4Fired++; | ||
}; | ||
fabric.util.object.extend(foo, fabric.Observable); | ||
foo.on('bar:baz', handler1); | ||
foo.on('bar:baz', handler2); | ||
foo.on('bar:baz', handler3); | ||
foo.on('bar:baz', handler4); | ||
foo.trigger('bar:baz'); | ||
equal(event1Fired, 1, 'Event 1 should fire once'); | ||
equal(event2Fired, 2, 'Event 2 should fire twice'); | ||
equal(event3Fired, 2, 'Event 3 should fire twice'); | ||
equal(event4Fired, 2, 'Event 4 should fire twice'); | ||
}); | ||
test('adding events', function() { | ||
var foo = { }, | ||
event1Fired = false, event2Fired = false, | ||
event3Fired = false, event4Fired = false, | ||
handler1 = function() { | ||
event1Fired = true; | ||
foo.off('bar:baz', handler1); | ||
foo.on('bar:baz', handler3); | ||
foo.on('bar:baz', handler4); | ||
}, | ||
handler2 = function() { | ||
event2Fired = true; | ||
}, | ||
handler3 = function() { | ||
event3Fired = true; | ||
}, | ||
handler4 = function() { | ||
event4Fired = true; | ||
}; | ||
fabric.util.object.extend(foo, fabric.Observable); | ||
foo.on('bar:baz', handler1); | ||
foo.on('bar:baz', handler2); | ||
foo.trigger('bar:baz'); | ||
equal(event1Fired, true, 'Event 1 should fire'); | ||
equal(event2Fired, true, 'Event 2 should fire'); | ||
equal(event3Fired, false, 'Event 3 should not fire'); | ||
equal(event4Fired, false, 'Event 4 should not fire'); | ||
foo.trigger('bar:baz'); | ||
equal(event3Fired, true, 'Event 3 should be triggered now'); | ||
equal(event4Fired, true, 'Event 4 should be triggered now'); | ||
}); | ||
test('chaining', function() { | ||
@@ -174,0 +277,0 @@ var foo = { }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5
16
6631288
34300
- Removedcanvas@1.3.x
- Removedjsdom@3.x.x
- Removedxmldom@0.1.x