Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fabric

Package Overview
Dependencies
Maintainers
2
Versions
304
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 4.0.0-beta.9 to 4.0.0-beta.10-browser

2

HEADER.js
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: '4.0.0-beta.9' };
var fabric = fabric || { version: '4.0.0-beta.10' };
if (typeof exports !== 'undefined') {

@@ -5,0 +5,0 @@ exports.fabric = fabric;

{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"homepage": "http://fabricjs.com/",
"version": "4.0.0-beta.9",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
"name": "Andrea Bogazzi",
"email": "andreabogazzi79@gmail.com"
}
],
"keywords": [
"canvas",
"graphic",
"graphics",
"SVG",
"node-canvas",
"parser",
"HTML5",
"object model"
],
"browser": {
"canvas": false,
"fs": false,
"jsdom": false,
"jsdom/lib/jsdom/living/generated/utils": false,
"jsdom/lib/jsdom/utils": false,
"http": false,
"https": false,
"xmldom": false,
"url": false
},
"repository": {
"type": "git",
"url": "https://github.com/fabricjs/fabric.js"
},
"bugs": {
"url": "https://github.com/fabricjs/fabric.js/issues"
},
"license": "MIT",
"scripts": {
"build": "node build.js modules=ALL requirejs exclude=gestures,accessors",
"build:fast": "node build.js modules=ALL requirejs fast exclude=gestures,accessors",
"build:watch": "onchange 'src/**/**' 'HEADER.js' 'lib/**/**' -- npm run build_export",
"link:watch": "onchange 'src/**/**' 'HEADER.js' 'lib/**/**' -- npm link",
"build_with_gestures": "node build.js modules=ALL exclude=accessors",
"build_export": "npm run build:fast && npm run export_dist_to_site",
"test:single": "qunit test/node_test_setup.js test/lib",
"test": "nyc qunit test/node_test_setup.js test/lib test/unit",
"test:visual": "qunit test/node_test_setup.js test/lib test/visual",
"test:visual:single": "qunit test/node_test_setup.js test/lib",
"test:all": "npm run test && npm run test:visual",
"lint": "eslint --config .eslintrc.json src",
"lint_tests": "eslint test/unit --config .eslintrc_tests && eslint test/visual --config .eslintrc_tests",
"export_dist_to_site": "cp dist/fabric.js ../fabricjs.com/lib/fabric.js && cp package.json ../fabricjs.com/lib/package.json && cp -r src HEADER.js lib ../fabricjs.com/build/files/",
"export_tests_to_site": "cp test/unit/*.js ../fabricjs.com/test/unit && cp -r test/visual/* ../fabricjs.com/test/visual && cp -r test/fixtures/* ../fabricjs.com/test/fixtures && cp -r test/lib/* ../fabricjs.com/test/lib",
"all": "npm run build && npm run test && npm run test:visual && npm run lint && npm run lint_tests && npm run export_dist_to_site && npm run export_tests_to_site",
"testem": "testem .",
"testem:visual": "testem --file testem-visual.json",
"testem:ci": "testem ci"
},
"optionalDependencies": {
"canvas": "^2.6.1",
"jsdom": "^15.1.0"
},
"devDependencies": {
"eslint": "4.18.x",
"nyc": "13.3.x",
"onchange": "^3.x.x",
"qunit": "2.9.2",
"testem": "^1.18.4",
"uglify-js": "3.3.x",
"pixelmatch": "^4.0.2",
"chalk": "^2.4.1"
},
"engines": {
"node": ">=8.0.0"
},
"main": "./dist/fabric.js",
"dependencies": {}
}
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"homepage": "http://fabricjs.com/",
"version": "4.0.0-beta.10-browser",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
"name": "Andrea Bogazzi",
"email": "andreabogazzi79@gmail.com"
}
],
"keywords": [
"canvas",
"graphic",
"graphics",
"SVG",
"node-canvas",
"parser",
"HTML5",
"object model"
],
"browser": {
"canvas": false,
"fs": false,
"jsdom": false,
"jsdom/lib/jsdom/living/generated/utils": false,
"jsdom/lib/jsdom/utils": false,
"http": false,
"https": false,
"xmldom": false,
"url": false
},
"repository": {
"type": "git",
"url": "https://github.com/fabricjs/fabric.js"
},
"bugs": {
"url": "https://github.com/fabricjs/fabric.js/issues"
},
"license": "MIT",
"scripts": {
"build": "node build.js modules=ALL requirejs exclude=gestures,accessors",
"build:fast": "node build.js modules=ALL requirejs fast exclude=gestures,accessors",
"build:watch": "onchange 'src/**/**' 'HEADER.js' 'lib/**/**' -- npm run build_export",
"link:watch": "onchange 'src/**/**' 'HEADER.js' 'lib/**/**' -- npm link",
"build_with_gestures": "node build.js modules=ALL exclude=accessors",
"build_export": "npm run build:fast && npm run export_dist_to_site",
"test:single": "qunit test/node_test_setup.js test/lib",
"test": "nyc qunit test/node_test_setup.js test/lib test/unit",
"test:visual": "qunit test/node_test_setup.js test/lib test/visual",
"test:visual:single": "qunit test/node_test_setup.js test/lib",
"test:all": "npm run test && npm run test:visual",
"lint": "eslint --config .eslintrc.json src",
"lint_tests": "eslint test/unit --config .eslintrc_tests && eslint test/visual --config .eslintrc_tests",
"export_dist_to_site": "cp dist/fabric.js ../fabricjs.com/lib/fabric.js && cp package.json ../fabricjs.com/lib/package.json && cp -r src HEADER.js lib ../fabricjs.com/build/files/",
"export_tests_to_site": "cp test/unit/*.js ../fabricjs.com/test/unit && cp -r test/visual/* ../fabricjs.com/test/visual && cp -r test/fixtures/* ../fabricjs.com/test/fixtures && cp -r test/lib/* ../fabricjs.com/test/lib",
"all": "npm run build && npm run test && npm run test:visual && npm run lint && npm run lint_tests && npm run export_dist_to_site && npm run export_tests_to_site",
"testem": "testem .",
"testem:visual": "testem --file testem-visual.json",
"testem:ci": "testem ci"
},
"optionalDependencies": {},
"devDependencies": {
"eslint": "4.18.x",
"nyc": "13.3.x",
"onchange": "^3.x.x",
"qunit": "2.9.2",
"testem": "^1.18.4",
"uglify-js": "3.3.x",
"pixelmatch": "^4.0.2",
"chalk": "^2.4.1"
},
"engines": {
"node": ">=8.0.0"
},
"main": "./dist/fabric.js",
"dependencies": {}
}

@@ -272,4 +272,1 @@ ### Fabric

SOFTWARE.
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/kangax/fabric.js/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

@@ -200,26 +200,6 @@ (function(global) {

positionHandler: function(dim, finalMatrix, fabricObject /* currentControl */ ) {
var padding = fabricObject.padding, angle = util.degreesToRadians(fabricObject.angle),
cos = util.cos(angle), sin = util.sin(angle), offsetX = this.offsetX,
offsetY = this.offsetY, cosP = cos * padding, sinP = sin * padding, cosY = cos * offsetY,
cosX = cos * offsetX, sinY = sin * offsetY, sinX = sin * offsetX,
point = util.transformPoint({
x: this.x * dim.x,
y: this.y * dim.y }, finalMatrix);
if (this.x > 0) {
point.x += cosP + cosX - sinY;
point.y += sinP + sinX + cosY;
}
if (this.x < 0) {
point.x += -cosP + cosX - sinY;
point.y += -sinP + sinX + cosY;
}
if (this.y > 0) {
point.x += -sinP + cosX - sinY;
point.y += cosP + sinX + cosY;
}
if (this.y < 0) {
point.x += sinP + cosX - sinY;
point.y += -cosP - sinX + cosY;
}
positionHandler: function(dim, finalMatrix /*, fabricObject, currentControl */) {
var point = util.transformPoint({
x: this.x * dim.x + this.offsetX,
y: this.y * dim.y + this.offsetY }, finalMatrix);
return point;

@@ -226,0 +206,0 @@ },

@@ -19,4 +19,5 @@ (function(global) {

var target = options.transform.target,
canvas = target.canvas;
canvas && canvas.fire('object:' + eventName, options);
canvas = target.canvas,
canasOptions = Object.assign({}, options, { target: target });
canvas && canvas.fire('object:' + eventName, canasOptions);
target.fire(eventName, options);

@@ -23,0 +24,0 @@ }

@@ -12,7 +12,8 @@ (function() {

var degreesToRadians = fabric.util.degreesToRadians,
multiplyMatrices = fabric.util.multiplyTransformMatrices,
transformPoint = fabric.util.transformPoint;
var util = fabric.util,
degreesToRadians = util.degreesToRadians,
multiplyMatrices = util.multiplyTransformMatrices,
transformPoint = util.transformPoint;
fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prototype */ {
util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prototype */ {

@@ -326,3 +327,3 @@ /**

var coords = this.getCoords(absolute, calculate);
return fabric.util.makeBoundingBoxFromPoints(coords);
return util.makeBoundingBoxFromPoints(coords);
},

@@ -424,3 +425,3 @@

var padding = this.padding, angle = degreesToRadians(this.angle),
cos = fabric.util.cos(angle), sin = fabric.util.sin(angle),
cos = util.cos(angle), sin = util.sin(angle),
cosP = cos * padding, sinP = sin * padding, cosPSinP = cosP + sinP,

@@ -458,11 +459,12 @@ cosPMinusSinP = cosP - sinP, aCoords = this.aCoords;

calcOCoords: function() {
var rotateMatrix = this._calcRotateMatrix(),
translateMatrix = this._calcTranslateMatrix(),
startMatrix = multiplyMatrices(translateMatrix, rotateMatrix),
var matrix = this.calcTransformMatrix(),
vpt = this.getViewportTransform(),
finalMatrix = multiplyMatrices(vpt, startMatrix),
dim = this._getTransformedDimensions(),
options = util.qrDecompose(multiplyMatrices(vpt, matrix));
options.scaleX = 1;
options.scaleY = 1;
var finalMatrix = util.composeMatrix(options),
dim = this._calculateCurrentDimensions(),
coords = {};
this.forEachControl(function(control, key, fabricObject) {
coords[key] = control.positionHandler(dim, finalMatrix, fabricObject);
coords[key] = control.positionHandler(dim, finalMatrix, fabricObject, control);
});

@@ -524,3 +526,3 @@

_calcRotateMatrix: function() {
return fabric.util.calcRotateMatrix(this);
return util.calcRotateMatrix(this);
},

@@ -584,3 +586,3 @@

cache.key = key;
cache.value = fabric.util.composeMatrix(this);
cache.value = util.composeMatrix(this);
return cache.value;

@@ -598,3 +600,3 @@ },

_calcDimensionsTransformMatrix: function(skewX, skewY, flipping) {
return fabric.util.calcDimensionsMatrix({
return util.calcDimensionsMatrix({
skewX: skewX,

@@ -670,3 +672,3 @@ skewY: skewY,

}],
transformMatrix = fabric.util.calcDimensionsMatrix({
transformMatrix = util.calcDimensionsMatrix({
scaleX: this.scaleX,

@@ -677,3 +679,3 @@ scaleY: this.scaleY,

}),
bbox = fabric.util.makeBoundingBoxFromPoints(points, transformMatrix);
bbox = util.makeBoundingBoxFromPoints(points, transformMatrix);
return this._finalizeDimensions(bbox.width, bbox.height);

@@ -704,3 +706,2 @@ },

p = transformPoint(dim, vpt, true);
return p.scalarAdd(2 * this.padding);

@@ -707,0 +708,0 @@ },

@@ -78,5 +78,5 @@ (function() {

this.source = fabric.util.createImage();
fabric.util.loadImage(options.source, function(img) {
fabric.util.loadImage(options.source, function(img, isError) {
_this.source = img;
callback && callback(_this);
callback && callback(_this, isError);
}, null, this.crossOrigin);

@@ -83,0 +83,0 @@ }

@@ -383,6 +383,6 @@ (function(global) {

setSrc: function(src, callback, options) {
fabric.util.loadImage(src, function(img) {
fabric.util.loadImage(src, function(img, isError) {
this.setElement(img, options);
this._setWidthHeight();
callback && callback(this);
callback && callback(this, isError);
}, this, options && options.crossOrigin);

@@ -691,5 +691,5 @@ return this;

var object = fabric.util.object.clone(_object);
fabric.util.loadImage(object.src, function(img, error) {
if (error) {
callback && callback(null, error);
fabric.util.loadImage(object.src, function(img, isError) {
if (isError) {
callback && callback(null, true);
return;

@@ -704,3 +704,3 @@ }

var image = new fabric.Image(img, object);
callback(image);
callback(image, false);
});

@@ -716,8 +716,8 @@ });

* @param {String} url URL to create an image from
* @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument)
* @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument). Second argument is a boolean indicating if an error occured or not.
* @param {Object} [imgOptions] Options object
*/
fabric.Image.fromURL = function(url, callback, imgOptions) {
fabric.util.loadImage(url, function(img) {
callback && callback(new fabric.Image(img, imgOptions));
fabric.util.loadImage(url, function(img, isError) {
callback && callback(new fabric.Image(img, imgOptions), isError);
}, null, imgOptions && imgOptions.crossOrigin);

@@ -724,0 +724,0 @@ };

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

* @example <caption>Stretched overlayImage #1 - width/height correspond to canvas width/height</caption>
* fabric.Image.fromURL('http://fabricjs.com/assets/jail_cell_bars.png', function(img) {
* fabric.Image.fromURL('http://fabricjs.com/assets/jail_cell_bars.png', function(img, isError) {
* img.set({width: canvas.width, height: canvas.height, originX: 'left', originY: 'top'});

@@ -351,3 +351,3 @@ * canvas.setOverlayImage(img, canvas.renderAll.bind(canvas));

* @example <caption>Stretched backgroundImage #1 - width/height correspond to canvas width/height</caption>
* fabric.Image.fromURL('http://fabricjs.com/assets/honey_im_subtle.png', function(img) {
* fabric.Image.fromURL('http://fabricjs.com/assets/honey_im_subtle.png', function(img, isError) {
* img.set({width: canvas.width, height: canvas.height, originX: 'left', originY: 'top'});

@@ -447,3 +447,3 @@ * canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas));

* @param {(fabric.Image|String|null)} image fabric.Image instance, URL of an image or null to set background or overlay to
* @param {Function} callback Callback to invoke when image is loaded and set as background or overlay
* @param {Function} callback Callback to invoke when image is loaded and set as background or overlay. The first argument is the created image, the second argument is a flag indicating whether an error occured or not.
* @param {Object} [options] Optional options to set for the {@link fabric.Image|image}.

@@ -453,3 +453,3 @@ */

if (typeof image === 'string') {
fabric.util.loadImage(image, function(img) {
fabric.util.loadImage(image, function(img, isError) {
if (img) {

@@ -460,3 +460,3 @@ var instance = new fabric.Image(img, options);

}
callback && callback(img);
callback && callback(img, isError);
}, this, options && options.crossOrigin);

@@ -468,3 +468,3 @@ }

image && (image.canvas = this);
callback && callback(image);
callback && callback(image, false);
}

@@ -471,0 +471,0 @@

@@ -348,3 +348,3 @@ (function(global) {

var onLoadCallback = function () {
callback && callback.call(context, img);
callback && callback.call(context, img, false);
img = img.onload = img.onerror = null;

@@ -351,0 +351,0 @@ };

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