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

2

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

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

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

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

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

@@ -10,3 +10,9 @@ var cp = require('child_process');

var args = process.argv.slice(2).join(' '); // args will be passed to npm publish (like --dry-run)
var preRelease = process.env.PRE_RELEASE;
// allow publishing of pre-releases with beta tag
if (preRelease) {
args = '--tag beta ' + args;
}
// override package.json with updated fields

@@ -13,0 +19,0 @@ fs.writeFileSync(

@@ -24,15 +24,37 @@ (function(global) {

function scaleCursorStyleHandler(eventData, corner, fabricObject) {
var canvas = fabricObject.canvas, uniScaleKey = canvas.uniScaleKey, notAllowed = 'not-allowed',
uniformIsToggled = eventData[uniScaleKey],
scaleIsProportional = (canvas.uniformScaling && !uniformIsToggled) ||
(!canvas.uniformScaling && uniformIsToggled);
function scaleIsProportional(eventData, fabricObject) {
var canvas = fabricObject.canvas, uniScaleKey = canvas.uniScaleKey,
uniformIsToggled = eventData[uniScaleKey];
return (canvas.uniformScaling && !uniformIsToggled) ||
(!canvas.uniformScaling && uniformIsToggled);
}
if (fabricObject.lockScalingX && fabricObject.lockScalingY) {
return notAllowed;
function scalingIsForbidden(fabricObject, by, scaleProportionally) {
var lockX = fabricObject.lockScalingX, lockY = fabricObject.lockScalingY;
if (lockX && lockY) {
return true;
}
if (corner.x !== 0 && fabricObject.lockScalingX && scaleIsProportional) {
return notAllowed;
if (!by && (lockX || lockY) && scaleProportionally) {
return true;
}
if (corner.y !== 0 && fabricObject.lockScalingY && scaleIsProportional) {
if (lockX && by === 'x') {
return true;
}
if (lockY && by === 'y') {
return true;
}
return false;
}
function scaleCursorStyleHandler(eventData, corner, fabricObject) {
var notAllowed = 'not-allowed',
scaleProportionally = scaleIsProportional(eventData, fabricObject),
by = '';
if (corner.x !== 0 && corner.y === 0) {
by = 'x';
}
else if (corner.x === 0 && corner.y !== 0) {
by = 'y';
}
if (scalingIsForbidden(fabricObject, by, scaleProportionally)) {
return notAllowed;

@@ -345,14 +367,11 @@ }

var target = transform.target,
uniScaleKey = target.canvas.uniScaleKey, isUniScalePressed = eventData[uniScaleKey],
lockScalingX = target.lockScalingX, lockScalingY = target.lockScalingY,
by = options.by, newPoint, scaleX, scaleY, dim;
by = options.by, newPoint, scaleX, scaleY, dim,
scaleProportionally = scaleIsProportional(eventData, target),
forbidScaling = scalingIsForbidden(target, by, scaleProportionally);
if (!isUniScalePressed && (lockScalingX || lockScalingY)) {
if (forbidScaling) {
return false;
}
if (isUniScalePressed && lockScalingX && lockScalingY) {
return false;
}
dim = target._getTransformedDimensions();

@@ -362,3 +381,3 @@ newPoint = getLocalPoint(target, transform.originX, transform.originY, x, y);

// missing detection of flip and logic to switch the origin
if (!isUniScalePressed && !by) {
if (scaleProportionally && !by) {
// uniform scaling

@@ -385,6 +404,7 @@ var distance = Math.abs(newPoint.x) + Math.abs(newPoint.y),

if (!by) {
target.set('scaleX', scaleX);
target.set('scaleY', scaleY);
!lockScalingX && target.set('scaleX', scaleX);
!lockScalingY && target.set('scaleY', scaleY);
}
else {
// forbidden cases already handled on top here.
by === 'x' && target.set('scaleX', scaleX);

@@ -430,4 +450,6 @@ by === 'y' && target.set('scaleY', scaleY);

function changeWidth(eventData, transform, x, y) {
var target = transform.target, localPoint = getLocalPoint(target, transform.originX, transform.originY, x, y);
transform.target.set('width', Math.abs(localPoint.x));
var target = transform.target, localPoint = getLocalPoint(target, transform.originX, transform.originY, x, y),
strokePadding = target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),
newWidth = Math.abs(localPoint.x / target.scaleX) - strokePadding;
target.set('width', Math.max(newWidth, 0));
return true;

@@ -434,0 +456,0 @@ }

@@ -137,2 +137,6 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOptions, doc) {

}
else {
// if clip-path does not resolve to any element, delete the property.
delete obj.clipPath;
}
};

@@ -139,0 +143,0 @@

@@ -177,2 +177,6 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.StaticCanvas.prototype */ {

var propIsColor =
_this.colorProperties.indexOf(property) > -1 ||
(propPair && _this.colorProperties.indexOf(propPair[1]) > -1);
var currentValue = propPair

@@ -186,10 +190,12 @@ ? this.get(propPair[0])[propPair[1]]

if (~to.indexOf('=')) {
to = currentValue + parseFloat(to.replace('=', ''));
if (!propIsColor) {
if (~to.indexOf('=')) {
to = currentValue + parseFloat(to.replace('=', ''));
}
else {
to = parseFloat(to);
}
}
else {
to = parseFloat(to);
}
fabric.util.animate({
var _options = {
startValue: options.from,

@@ -200,6 +206,6 @@ endValue: to,

duration: options.duration,
abort: options.abort && function() {
abort: options.abort && function () {
return options.abort.call(_this);
},
onChange: function(value, valueProgress, timeProgress) {
onChange: function (value, valueProgress, timeProgress) {
if (propPair) {

@@ -216,3 +222,3 @@ _this[propPair[0]][propPair[1]] = value;

},
onComplete: function(value, valueProgress, timeProgress) {
onComplete: function (value, valueProgress, timeProgress) {
if (skipCallbacks) {

@@ -225,4 +231,11 @@ return;

}
});
};
if (propIsColor) {
fabric.util.animateColor(_options.startValue, _options.endValue, _options.duration, _options);
}
else {
fabric.util.animate(_options);
}
}
});

@@ -96,2 +96,4 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.prototype */ {

* find selectionEnd, initialize the drawing of either cursor or selection area
* initializing a mousedDown on a text area will cancel fabricjs knowledge of
* current compositionMode. It will be set to false.
*/

@@ -106,2 +108,3 @@ _mouseDownHandler: function(options) {

if (this.selected) {
this.inCompositionMode = false;
this.setCursorByClick(options.e);

@@ -108,0 +111,0 @@ }

@@ -83,7 +83,8 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.prototype */ {

/**
* Handles keyup event
* Handles keydown event
* only used for arrows and combination of modifier keys.
* @param {Event} e Event object
*/
onKeyDown: function(e) {
if (!this.isEditing || this.inCompositionMode) {
if (!this.isEditing) {
return;

@@ -104,2 +105,3 @@ }

// if i press an arrow key just update selection
this.inCompositionMode = false;
this.clearContextTop();

@@ -106,0 +108,0 @@ this.renderCursorOrSelection();

@@ -12,3 +12,3 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prototype */ {

}
else {
else if (this.canvas) {
this.canvas.sendToBack(this);

@@ -28,3 +28,3 @@ }

}
else {
else if (this.canvas) {
this.canvas.bringToFront(this);

@@ -45,3 +45,3 @@ }

}
else {
else if (this.canvas) {
this.canvas.sendBackwards(this, intersecting);

@@ -62,3 +62,3 @@ }

}
else {
else if (this.canvas) {
this.canvas.bringForward(this, intersecting);

@@ -79,3 +79,3 @@ }

}
else {
else if (this.canvas) {
this.canvas.moveTo(this, index);

@@ -82,0 +82,0 @@ }

@@ -105,7 +105,5 @@ /* _TO_SVG_START_ */

getSvgTextDecoration: function(style) {
if ('overline' in style || 'underline' in style || 'linethrough' in style) {
return (style.overline ? 'overline ' : '') +
(style.underline ? 'underline ' : '') + (style.linethrough ? 'line-through ' : '');
}
return '';
return ['overline', 'underline', 'line-through'].filter(function(decoration) {
return style[decoration.replace('-', '')];
}).join(' ');
},

@@ -112,0 +110,0 @@

@@ -969,4 +969,4 @@ (function(global) {

for (i = 0, len = styles.length; i < len; i++) {
// IE9 doesn't support textContent, but provides text instead.
var styleContents = styles[i].textContent || styles[i].text;
// <style/> could produce `undefined`, covering this case with ''
var styleContents = styles[i].textContent || '';

@@ -973,0 +973,0 @@ // remove comments

@@ -1402,4 +1402,11 @@ (function () {

style, row, rowIndex, _char, charIndex, i, len,
fontPaths = fabric.fontPaths, objects = this._objects;
fontPaths = fabric.fontPaths, objects = [];
this._objects.forEach(function add(object) {
objects.push(object);
if (object._objects) {
object._objects.forEach(add);
}
});
for (i = 0, len = objects.length; i < len; i++) {

@@ -1406,0 +1413,0 @@ obj = objects[i];

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

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