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.6-browser to 4.0.0-beta.7-browser

2

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

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

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

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

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

@@ -60,13 +60,2 @@ /**

/**
* Sets shadow of an object
* @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)")
* @return {fabric.Object} thisArg
* @chainable
*/
setShadow: function(options) {
this.shadow = new fabric.Shadow(options);
return this;
},
/**
* Sets brush styles

@@ -73,0 +62,0 @@ * @private

@@ -103,3 +103,3 @@ /**

this.shadow && circle.setShadow(this.shadow);
this.shadow && (circle.shadow = new fabric.Shadow(this.shadow));

@@ -106,0 +106,0 @@ circles.push(circle);

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

this.shadow.affectStroke = true;
path.setShadow(this.shadow);
path.shadow = new fabric.Shadow(this.shadow);
}

@@ -233,0 +233,0 @@

@@ -113,3 +113,3 @@ /**

var group = new fabric.Group(rects);
this.shadow && group.setShadow(this.shadow);
this.shadow && group.set('shadow', new fabric.Shadow(this.shadow));
this.canvas.add(group);

@@ -116,0 +116,0 @@ this.canvas.fire('path:created', { path: group });

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

* @fires object:skewing while an object is being skewed from the controls
* @fires object:selected this event is deprecated. use selection:created
*

@@ -662,4 +661,3 @@ * @fires before:transform before a transform is is started

var pointer = this.getPointer(e), isTouch = isTouchEvent(e),
corner = target._findTargetCorner(this.getPointer(e, true), isTouch),
var pointer = this.getPointer(e), corner = target.__corner,
actionHandler = !!corner && target.controls[corner].getActionHandler(),

@@ -1155,7 +1153,2 @@ action = this._getActionFromCorner(alreadySelected, corner, e, target),

else if (objects.length > 0) {
// deprecated event
if (objects.length === 1) {
opt.target = added[0];
this.fire('object:selected', opt);
}
opt.selected = added;

@@ -1162,0 +1155,0 @@ // added for backward compatibility

@@ -131,2 +131,24 @@ (function(global) {

/**
* Returns control mouseDown handler
* @param {Event} eventData the native mouse event
* @param {Object} transformData properties of the current transform
* @param {fabric.Object} object on which the control is displayed
* @return {Function}
*/
getMouseDownHandler: function(/* eventData, fabricObject, control */) {
return this.mouseDownHandler;
},
/**
* Returns control mouseUp handler
* @param {Event} eventData the native mouse event
* @param {Object} transformData properties of the current transform
* @param {fabric.Object} object on which the control is displayed
* @return {Function}
*/
getMouseUpHandler: function(/* eventData, fabricObject, control */) {
return this.mouseUpHandler;
},
/**
* Returns control cursorStyle for css using cursorStyle. If you need a more elaborate

@@ -133,0 +155,0 @@ * function you can pass one in the constructor

@@ -455,23 +455,4 @@ (function() {

return gradient;
},
}
/* _FROM_SVG_END_ */
/**
* Returns {@link fabric.Gradient} instance from its object representation
* this function is uniquely used by Object.setGradient and is deprecated with it.
* @static
* @deprecated since 3.4.0
* @memberOf fabric.Gradient
* @param {Object} obj
* @param {Object} [options] Options object
*/
forObject: function(obj, options) {
options || (options = { });
__convertPercentUnitsToValues(obj, options.coords, options.gradientUnits, {
// those values are to avoid errors. this function is uniquely used by
viewBoxWidth: 100,
viewBoxHeight: 100,
});
return new fabric.Gradient(options);
}
});

@@ -478,0 +459,0 @@

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

}
if (!isClick) {

@@ -450,2 +449,11 @@ this._maybeGroupObjects(e);

if (target) {
var corner = target._findTargetCorner(
this.getPointer(e, true),
fabric.util.isTouchEvent(e)
);
var control = target.controls[corner],
mouseUpHandler = control && control.getMouseUpHandler(e, target, control);
if (mouseUpHandler) {
mouseUpHandler(e, target, control);
}
target.isMoving = false;

@@ -603,5 +611,2 @@ }

}
if (this.clipTo) {
fabric.util.clipContext(this, this.contextTop);
}
var pointer = this.getPointer(e);

@@ -630,5 +635,2 @@ this.freeDrawingBrush.onMouseDown(pointer, { e: e, pointer: pointer });

_onMouseUpInDrawingMode: function(e) {
if (this.clipTo) {
this.contextTop.restore();
}
var pointer = this.getPointer(e);

@@ -708,3 +710,13 @@ this._isCurrentlyDrawing = this.freeDrawingBrush.onMouseUp({ e: e, pointer: pointer });

}
if (target === this._activeObject && (target.__corner || !shouldGroup)) {
var corner = target._findTargetCorner(
this.getPointer(e, true),
fabric.util.isTouchEvent(e)
);
target.__corner = corner;
if (target === this._activeObject && (corner || !shouldGroup)) {
var control = target.controls[corner],
mouseDownHandler = control && control.getMouseDownHandler(e, target, control);
if (mouseDownHandler) {
mouseDownHandler(e, target, control);
}
this._setupCurrentTransform(e, target, alreadySelected);

@@ -711,0 +723,0 @@ }

fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.StaticCanvas.prototype */ {
/**
* Populates canvas with data from the specified dataless JSON.
* JSON format must conform to the one of {@link fabric.Canvas#toDatalessJSON}
* @deprecated since 1.2.2
* @param {String|Object} json JSON string or object
* @param {Function} callback Callback, invoked when json is parsed
* and corresponding objects (e.g: {@link fabric.Image})
* are initialized
* @param {Function} [reviver] Method for further parsing of JSON elements, called after each fabric object created.
* @return {fabric.Canvas} instance
* @chainable
* @tutorial {@link http://fabricjs.com/fabric-intro-part-3#deserialization}
*/
loadFromDatalessJSON: function (json, callback, reviver) {
return this.loadFromJSON(json, callback, reviver);
},
/**
* Populates canvas with data from the specified JSON.

@@ -234,3 +216,2 @@ * JSON format must conform to the one of {@link fabric.Canvas#toJSON}

var clone = new fabric.Canvas(el);
clone.clipTo = this.clipTo;
if (this.backgroundImage) {

@@ -237,0 +218,0 @@ clone.setBackgroundImage(this.backgroundImage.src, function() {

@@ -140,13 +140,5 @@ /* _TO_SVG_START_ */

return svgTransform +
(additionalTransform || '') + this.getSvgTransformMatrix() + '" ';
(additionalTransform || '') + '" ';
},
/**
* Returns transform-string for svg-export from the transform matrix of single elements
* @return {String}
*/
getSvgTransformMatrix: function() {
return this.transformMatrix ? ' ' + fabric.util.matrixToSVG(this.transformMatrix) : '';
},
_setSVGBg: function(textBgRects) {

@@ -153,0 +145,0 @@ if (this.backgroundColor) {

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

* Observes specified event
* @deprecated `observe` deprecated since 0.8.34 (use `on` instead)
* @memberOf fabric.Observable

@@ -32,3 +31,3 @@ * @alias on

*/
function observe(eventName, handler) {
function on(eventName, handler) {
if (!this.__eventListeners) {

@@ -55,3 +54,2 @@ this.__eventListeners = { };

* without arguments removes all handlers for all events
* @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead)
* @memberOf fabric.Observable

@@ -64,3 +62,3 @@ * @alias off

*/
function stopObserving(eventName, handler) {
function off(eventName, handler) {
if (!this.__eventListeners) {

@@ -90,5 +88,3 @@ return this;

* Fires event with an optional options object
* @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead)
* @memberOf fabric.Observable
* @alias trigger
* @param {String} eventName Event name to fire

@@ -124,10 +120,6 @@ * @param {Object} [options] Options object

fabric.Observable = {
observe: observe,
stopObserving: stopObserving,
fire: fire,
on: observe,
off: stopObserving,
trigger: fire
on: on,
off: off,
};
})();

@@ -44,18 +44,3 @@ /**

* @private
* @param {Object} [options] Options object
*/
_initClipping: function(options) {
if (!options.clipTo || typeof options.clipTo !== 'string') {
return;
}
var functionBody = fabric.util.getFunctionBody(options.clipTo);
if (typeof functionBody !== 'undefined') {
this.clipTo = new Function('ctx', functionBody);
}
},
/**
* @private
*/
_setObject: function(obj) {

@@ -79,8 +64,3 @@ for (var prop in obj) {

else {
if (typeof value === 'function' && key !== 'clipTo') {
this._set(key, value(this.get(key)));
}
else {
this._set(key, value);
}
this._set(key, value);
}

@@ -87,0 +67,0 @@ return this;

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

this.transform(ctx);
this.transformMatrix && ctx.transform.apply(ctx, this.transformMatrix);
this._clearTextArea(ctx);

@@ -274,0 +273,0 @@ skipRestore || ctx.restore();

@@ -60,6 +60,2 @@ (function () {

* Background image of canvas instance.
* Should be set via {@link fabric.StaticCanvas#setBackgroundImage}.
* <b>Backwards incompatibility note:</b> The "backgroundImageOpacity"
* and "backgroundImageStretch" properties are deprecated since 1.3.9.
* Use {@link fabric.Image#opacity}, {@link fabric.Image#width} and {@link fabric.Image#height}.
* since 2.4.0 image caching is active, please when putting an image as background, add to the

@@ -84,6 +80,2 @@ * canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom

* Overlay image of canvas instance.
* Should be set via {@link fabric.StaticCanvas#setOverlayImage}.
* <b>Backwards incompatibility note:</b> The "overlayImageLeft"
* and "overlayImageTop" properties are deprecated since 1.3.9.
* Use {@link fabric.Image#left} and {@link fabric.Image#top}.
* since 2.4.0 image caching is active, please when putting an image as overlay, add to the

@@ -125,14 +117,2 @@ * canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom

/**
* Function that determines clipping of entire canvas area
* Being passed context as first argument.
* If you are using code minification, ctx argument can be minified/manglied you should use
* as a workaround `var ctx = arguments[0];` in the function;
* See clipping canvas area in {@link https://github.com/kangax/fabric.js/wiki/FAQ}
* @deprecated since 2.0.0
* @type Function
* @default
*/
clipTo: null,
/**
* Indicates whether object controls (borders/controls) are rendered above overlay image

@@ -935,5 +915,2 @@ * @type Boolean

this.fire('before:render', { ctx: ctx, });
if (this.clipTo) {
fabric.util.clipContext(this, ctx);
}
this._renderBackground(ctx);

@@ -949,5 +926,2 @@

}
if (this.clipTo) {
ctx.restore();
}
if (path) {

@@ -954,0 +928,0 @@ path.canvas = this;

@@ -631,16 +631,2 @@ (function(global) {

/**
* @static
* @memberOf fabric.util
* @deprecated since 2.0.0
* @param {fabric.Object} receiver Object implementing `clipTo` method
* @param {CanvasRenderingContext2D} ctx Context to clip
*/
clipContext: function(receiver, ctx) {
ctx.save();
ctx.beginPath();
receiver.clipTo(ctx);
ctx.clip();
},
/**
* Multiply matrix A by matrix B to nest transformations

@@ -786,17 +772,2 @@ * @static

/**
* Returns a transform matrix that has the same effect of scaleX, scaleY and skewX.
* Is deprecated for composeMatrix. Please do not use it.
* @static
* @deprecated since 3.4.0
* @memberOf fabric.util
* @param {Number} scaleX
* @param {Number} scaleY
* @param {Number} skewX
* @return {Number[]} transform matrix
*/
customTransformMatrix: function(scaleX, scaleY, skewX) {
return fabric.util.composeMatrix({ scaleX: scaleX, scaleY: scaleY, skewX: skewX });
},
/**
* reset an object transform state to neutral. Top and left are not accounted for

@@ -962,2 +933,15 @@ * @static

/**
* Finds the scale for the object source to fit inside the object destination,
* keeping aspect ratio intact.
* respect the total allowed area for the cache.
* @memberOf fabric.util
* @param {Object | fabric.Object} source
* @param {Number} source.height natural unscaled height of the object
* @param {Number} source.width natural unscaled width of the object
* @param {Object | fabric.Object} destination
* @param {Number} destination.height natural unscaled height of the object
* @param {Number} destination.width natural unscaled width of the object
* @return {Number} scale factor to apply to source to fit into destination
*/
findScaleToFit: function(source, destination) {

@@ -967,2 +951,15 @@ return Math.min(destination.width / source.width, destination.height / source.height);

/**
* Finds the scale for the object source to cover entirely the object destination,
* keeping aspect ratio intact.
* respect the total allowed area for the cache.
* @memberOf fabric.util
* @param {Object | fabric.Object} source
* @param {Number} source.height natural unscaled height of the object
* @param {Number} source.width natural unscaled width of the object
* @param {Object | fabric.Object} destination
* @param {Number} destination.height natural unscaled height of the object
* @param {Number} destination.width natural unscaled width of the object
* @return {Number} scale factor to apply to source to cover destination
*/
findScaleToCover: function(source, destination) {

@@ -969,0 +966,0 @@ return Math.max(destination.width / source.width, destination.height / source.height);

@@ -191,18 +191,2 @@ (function() {

/**
* Retrieves object's {@link fabric.Object#clipTo|clipping function}
* @method getClipTo
* @memberOf fabric.Object.prototype
* @return {Function}
*/
/**
* Sets object's {@link fabric.Object#clipTo|clipping function}
* @method setClipTo
* @memberOf fabric.Object.prototype
* @param {Function} clipTo Clipping function
* @return {fabric.Object} thisArg
* @chainable
*/
/**
* Retrieves object's {@link fabric.Object#transformMatrix|transformMatrix}

@@ -209,0 +193,0 @@ * @method getTransformMatrix

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

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