New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fabric

Package Overview
Dependencies
Maintainers
2
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabric - npm Package Compare versions

Comparing version 2.0.0-beta.5 to 2.0.0-beta.6

1

build.js

@@ -224,2 +224,3 @@ var fs = require('fs'),

ifSpecifiedInclude('image_filters', 'src/filters/composed_filter.class.js'),
ifSpecifiedInclude('image_filters', 'src/filters/hue_rotation.class.js'),

@@ -226,0 +227,0 @@ ifSpecifiedInclude('text', 'src/shapes/text.class.js'),

2

package.json

@@ -5,3 +5,3 @@ {

"homepage": "http://fabricjs.com/",
"version": "2.0.0-beta.5",
"version": "2.0.0-beta.6",
"author": "Juriy Zaytsev <kangax@gmail.com>",

@@ -8,0 +8,0 @@ "contributors": [

@@ -622,7 +622,7 @@ (function() {

rect.setAngle('60');
rect.rotate('60');
canvas.straightenObject(rect);
equal(rect.get('angle'), 90, 'angle should be coerced to 90 (from 60)');
rect.setAngle('100');
rect.rotate('100');
canvas.straightenObject(rect);

@@ -629,0 +629,0 @@ equal(rect.get('angle'), 90, 'angle should be coerced to 90 (from 100)');

@@ -344,3 +344,73 @@ (function() {

QUnit.module('fabric.Image.filters.HueRotation');
test('constructor', function() {
ok(fabric.Image.filters.HueRotation);
var filter = new fabric.Image.filters.HueRotation();
ok(filter instanceof fabric.Image.filters.ColorMatrix, 'should inherit from fabric.Image.filters.ColorMatrix');
ok(filter instanceof fabric.Image.filters.HueRotation, 'should inherit from fabric.Image.filters.HueRotation');
});
test('properties', function() {
var filter = new fabric.Image.filters.HueRotation();
equal(filter.type, 'HueRotation');
equal(filter.rotation, 0, 'default rotation is 0');
var filter2 = new fabric.Image.filters.HueRotation({ rotation: 0.5 });
equal(filter2.rotation, 0.5, 'rotation is 0.5');
});
test('applyTo2d', function() {
var filter = new fabric.Image.filters.HueRotation();
ok(typeof filter.applyTo2d === 'function');
});
test('applyTo2d values', function() {
var filter = new fabric.Image.filters.HueRotation({ rotation: 0.5 });
var options = { imageData: _createImageData(context) };
filter.calculateMatrix();
filter.applyTo2d(options);
var data = options.imageData.data;
var expected = [88, 203, 59, 1, 0, 110, 228, 1, 26, 255, 171, 1];
for (var i = 0; i < 12; i++) {
equal(data[i], expected[i]);
}
});
test('toObject', function() {
var filter = new fabric.Image.filters.HueRotation();
ok(typeof filter.toObject === 'function');
var object = filter.toObject();
equal(JSON.stringify(object), '{"type":"HueRotation","rotation":0}');
filter.rotation = 0.6;
object = filter.toObject();
equal(JSON.stringify(object), '{"type":"HueRotation","rotation":0.6}');
});
test('toJSON', function() {
var filter = new fabric.Image.filters.HueRotation();
ok(typeof filter.toJSON === 'function');
var json = filter.toJSON();
equal(JSON.stringify(json), '{"type":"HueRotation","rotation":0}');
filter.rotation = 0.3;
json = filter.toJSON();
equal(JSON.stringify(json), '{"type":"HueRotation","rotation":0.3}');
});
test('fromObject', function() {
var filter = new fabric.Image.filters.HueRotation();
var object = filter.toObject();
deepEqual(fabric.Image.filters.HueRotation.fromObject(object), filter);
});
QUnit.module('fabric.Image.filters.Contrast');

@@ -347,0 +417,0 @@

@@ -264,3 +264,3 @@ (function(){

var event = { stopPropagation: function(){}, preventDefault: function(){} };
var iText = new fabric.IText('test', { styles: { 0: { 0: { fill: 'red' }, 1: { fill: 'blue' }}}});
var iText = new fabric.IText('test', { fontSize: 25, styles: { 0: { 0: { fill: 'red' }, 1: { fill: 'blue' }}}});
iText.selectionStart = 0;

@@ -270,5 +270,7 @@ iText.selectionEnd = 2;

equal(fabric.copiedText, 'te', 'it copied first 2 characters');
equal(fabric.copiedTextStyle[0], iText.styles[0][0], 'style is referenced');
equal(fabric.copiedTextStyle[1], iText.styles[0][1], 'style is referenced');
equal(fabric.copiedTextStyle[0].fill, iText.styles[0][0].fill, 'style is cloned');
equal(fabric.copiedTextStyle[1].fill, iText.styles[0][1].fill, 'style is referenced');
equal(iText.styles[0][1].fontSize, undefined, 'style had not fontSize');
equal(fabric.copiedTextStyle[1].fontSize, 25, 'style took fontSize from text element');
});
})();

@@ -246,2 +246,4 @@ (function() {

equal(iText.selectionEnd, 4);
equal(iText.selectAll(), iText, 'should be chainable');
});

@@ -510,2 +512,4 @@

equal(iText.selectionEnd, 20);
equal(iText.selectLine(0), iText, 'should be chainable');
});

@@ -512,0 +516,0 @@

@@ -510,3 +510,3 @@ (function(){

test('setAngle', function() {
test('rotate', function() {
var cObj = new fabric.Object();

@@ -544,3 +544,3 @@ equal(cObj.get('angle'), 0);

// augmenting clone properties should not affect original instance
clone.set('left', 12).set('scaleX', 2.5).setAngle(33);
clone.set('left', 12).set('scaleX', 2.5).rotate(33);

@@ -690,23 +690,23 @@ equal(cObj.get('left'), 123);

object.setAngle(123.456);
object.rotate(123.456);
object.straighten();
equal(object.get('angle'), 90);
object.setAngle(97.111);
object.rotate(97.111);
object.straighten();
equal(object.get('angle'), 90);
object.setAngle(3.45);
object.rotate(3.45);
object.straighten();
equal(object.get('angle'), 0);
object.setAngle(-157);
object.rotate(-157);
object.straighten();
equal(object.get('angle'), -180);
object.setAngle(159);
object.rotate(159);
object.straighten();
equal(object.get('angle'), 180);
object.setAngle(999);
object.rotate(999);
object.straighten();

@@ -784,13 +784,2 @@ equal(object.get('angle'), 270);

test('remove', function() {
var object = new fabric.Object();
ok(typeof object.remove == 'function');
canvas.add(object);
equal(object.remove(), object, 'should be chainable');
equal(canvas.getObjects().length, 0);
});
test('object:removed', function() {

@@ -803,3 +792,3 @@ var object = new fabric.Object();

object.on('removed', function(){ removedEventFired = true; });
object.remove();
canvas.remove(object);

@@ -806,0 +795,0 @@ ok(removedEventFired);

@@ -255,3 +255,2 @@ (function() {

underline: true,
originX: 'left'
});

@@ -258,0 +257,0 @@

@@ -587,10 +587,2 @@ (function() {

test('fabric.util.request', function() {
ok(typeof fabric.util.request === 'function', 'fabric.util.request is a function');
});
test('fabric.util.getPointer', function() {
ok(typeof fabric.util.getPointer === 'function', 'fabric.util.getPointer is a function');
});
test('fabric.util.addListener', function() {

@@ -801,2 +793,10 @@ ok(typeof fabric.util.addListener === 'function', 'fabric.util.addListener is a function');

test('fabric.util.request', function() {
ok(typeof fabric.util.request === 'function', 'fabric.util.request is a function');
});
test('fabric.util.getPointer', function() {
ok(typeof fabric.util.getPointer === 'function', 'fabric.util.getPointer is a function');
});
test('rotateVector', function() {

@@ -808,2 +808,10 @@ ok(typeof fabric.util.rotateVector == 'function');

ok(typeof fabric.util.rotatePoint == 'function');
var origin = new fabric.Point(3, 0);
var point = new fabric.Point(4, 0);
var rotated = fabric.util.rotatePoint(point, origin, Math.PI);
equal(Math.round(rotated.x), 2);
equal(Math.round(rotated.y), 0);
var rotated = fabric.util.rotatePoint(point, origin, Math.PI / 2);
equal(Math.round(rotated.x), 3);
equal(Math.round(rotated.y), -2);
});

@@ -813,2 +821,7 @@

ok(typeof fabric.util.transformPoint == 'function');
var point = new fabric.Point(2, 2);
var matrix = [3, 0, 0, 2, 10, 4];
var tp = fabric.util.transformPoint(point, matrix);
equal(Math.round(tp.x), 16);
equal(Math.round(tp.y), 8);
});

@@ -830,7 +843,12 @@

test('createCanvasElement', function() {
ok(typeof fabric.util.createCanvasElement == 'function');
ok(typeof fabric.util.createCanvasElement === 'function');
var element = fabric.util.createCanvasElement();
ok(element.getContext);
});
test('createImage', function() {
ok(typeof fabric.util.createImage == 'function');
ok(typeof fabric.util.createImage === 'function');
var element = fabric.util.createImage();
equal(element.naturalHeight, 0);
equal(element.naturalWidth, 0);
});

@@ -842,6 +860,26 @@

test('qrDecompose', function() {
test('qrDecompose with identity matrix', function() {
ok(typeof fabric.util.qrDecompose == 'function');
var options = fabric.util.qrDecompose(fabric.iMatrix);
equal(options.scaleX, 1, 'imatrix has scale 1');
equal(options.scaleY, 1, 'imatrix has scale 1');
equal(options.skewX, 0, 'imatrix has skewX 0');
equal(options.skewY, 0, 'imatrix has skewY 0');
equal(options.angle, 0, 'imatrix has angle 0');
equal(options.translateX, 0, 'imatrix has translateX 0');
equal(options.translateY, 0, 'imatrix has translateY 0');
});
test('qrDecompose with matrix', function() {
ok(typeof fabric.util.qrDecompose == 'function');
var options = fabric.util.qrDecompose([2, 0.4, 0.5, 3, 100, 200]);
equal(Math.round(options.scaleX, 4), 2, 'imatrix has scale');
equal(Math.round(options.scaleY, 4), 3, 'imatrix has scale');
equal(Math.round(options.skewX, 4), 28, 'imatrix has skewX');
equal(options.skewY, 0, 'imatrix has skewY 0');
equal(Math.round(options.angle, 4), 11, 'imatrix has angle 0');
equal(options.translateX, 100, 'imatrix has translateX 100');
equal(options.translateY, 200, 'imatrix has translateY 200');
});
test('drawArc', function() {

@@ -848,0 +886,0 @@ ok(typeof fabric.util.drawArc == 'function');

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

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc