Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.4.0 #6997

Merged
merged 3 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [4.4.0]

- fix(fabric.Object) wrong variable name `cornerStrokeColor ` [#6981](https://github.com/fabricjs/fabric.js/pull/6981)
- fix(fabric.Text): underline color with text style ( regression from text on a path) [#6974](https://github.com/fabricjs/fabric.js/pull/6974)
- fix(fabric.Image): Cache CropX and CropY cache properties [#6924](https://github.com/fabricjs/fabric.js/pull/6924)
- fix(fabric.Canvas): Add target to each selection event [#6858](https://github.com/fabricjs/fabric.js/pull/6858)
- fix(fabric.Image): fix wrong scaling value for the y axis in renderFill [#6778](https://github.com/fabricjs/fabric.js/pull/6778)
- fix(fabric.Canvas): set isMoving on real movement only [#6856](https://github.com/fabricjs/fabric.js/pull/6856)
- fix(fabric.Group) make addWithUpdate compatible with nested groups [#6774](https://github.com/fabricjs/fabric.js/pull/6774)
- fix(Fabric.Text): Add path to text export and import [#6844](https://github.com/fabricjs/fabric.js/pull/6844)
- fix(fabric.Canvas) Remove controls check in the pixel accuracy target [#6798](https://github.com/fabricjs/fabric.js/pull/6798)
- feat(fabric.Canvas): Added activeOn 'up/down' property [#6807](https://github.com/fabricjs/fabric.js/pull/6807)
- feat(fabric.BaseBrush): limitedToCanvasSize property to brush [#6719](https://github.com/fabricjs/fabric.js/pull/6719)

## [4.3.1]

- fix(fabric.Control) implement targetHasOneFlip using shorthand [#6823](https://github.com/fabricjs/fabric.js/pull/6823)
Expand Down
2 changes: 1 addition & 1 deletion HEADER.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: '4.3.1' };
var fabric = fabric || { version: '4.4.0' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down
81 changes: 60 additions & 21 deletions dist/fabric.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* build: `node build.js modules=ALL exclude=gestures,accessors requirejs minifier=uglifyjs` */
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: '4.3.1' };
var fabric = fabric || { version: '4.4.0' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down Expand Up @@ -7122,7 +7122,7 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
), xSizeBy2 = xSize / 2, ySizeBy2 = ySize / 2;
ctx.save();
ctx.fillStyle = styleOverride.cornerColor || fabricObject.cornerColor;
ctx.strokeStyle = styleOverride.strokeCornerColor || fabricObject.strokeCornerColor;
ctx.strokeStyle = styleOverride.cornerStrokeColor || fabricObject.cornerStrokeColor;
// this is still wrong
ctx.lineWidth = 1;
ctx.translate(left, top);
Expand Down Expand Up @@ -12175,38 +12175,50 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
*/
_fireSelectionEvents: function(oldObjects, e) {
var somethingChanged = false, objects = this.getActiveObjects(),
added = [], removed = [], opt = { e: e };
added = [], removed = [];
oldObjects.forEach(function(oldObject) {
if (objects.indexOf(oldObject) === -1) {
somethingChanged = true;
oldObject.fire('deselected', opt);
oldObject.fire('deselected', {
e: e,
target: oldObject
});
removed.push(oldObject);
}
});
objects.forEach(function(object) {
if (oldObjects.indexOf(object) === -1) {
somethingChanged = true;
object.fire('selected', opt);
object.fire('selected', {
e: e,
target: object
});
added.push(object);
}
});
if (oldObjects.length > 0 && objects.length > 0) {
opt.selected = added;
opt.deselected = removed;
// added for backward compatibility
opt.updated = added[0] || removed[0];
opt.target = this._activeObject;
somethingChanged && this.fire('selection:updated', opt);
somethingChanged && this.fire('selection:updated', {
e: e,
selected: added,
deselected: removed,
// added for backward compatibility
// deprecated
updated: added[0] || removed[0],
target: this._activeObject,
});
}
else if (objects.length > 0) {
opt.selected = added;
// added for backward compatibility
opt.target = this._activeObject;
this.fire('selection:created', opt);
this.fire('selection:created', {
e: e,
selected: added,
target: this._activeObject,
});
}
else if (oldObjects.length > 0) {
opt.deselected = removed;
this.fire('selection:cleared', opt);
this.fire('selection:cleared', {
e: e,
deselected: removed,
});
}
},

Expand All @@ -12225,6 +12237,10 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
},

/**
* This is a private method for now.
* This is supposed to be equivalent to setActiveObject but without firing
* any event. There is commitment to have this stay this way.
* This is the functional part of setActiveObject.
* @private
* @param {Object} object to set as active
* @param {Event} [e] Event (passed along when firing "object:selected")
Expand All @@ -12245,6 +12261,13 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
},

/**
* This is a private method for now.
* This is supposed to be equivalent to discardActiveObject but without firing
* any events. There is commitment to have this stay this way.
* This is the functional part of discardActiveObject.
* @param {Event} [e] Event (passed along when firing "object:deselected")
* @param {Object} object to set as active
* @return {Boolean} true if the selection happened
* @private
*/
_discardActiveObject: function(e, object) {
Expand Down Expand Up @@ -20489,6 +20512,15 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
*/
stateProperties: fabric.Object.prototype.stateProperties.concat('cropX', 'cropY'),

/**
* List of properties to consider when checking if cache needs refresh
* Those properties are checked by statefullCache ON ( or lazy mode if we want ) or from single
* calls to Object.set(key, value). If the key is in this list, the object is marked as dirty
* and refreshed at the next render
* @type Array
*/
cacheProperties: fabric.Object.prototype.cacheProperties.concat('cropX', 'cropY'),

/**
* key used to retrieve the texture representing this image
* @since 2.0.0
Expand Down Expand Up @@ -20524,7 +20556,11 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot

/**
* Constructor
* @param {HTMLImageElement | String} element Image element
* Image can be initialized with any canvas drawable or a string.
* The string should be a url and will be loaded as an image.
* Canvas and Image element work out of the box, while videos require extra code to work.
* Please check video element events for seeking.
* @param {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String} element Image element
* @param {Object} [options] Options object
* @param {function} [callback] callback function to call after eventual filters applied.
* @return {fabric.Image} thisArg
Expand Down Expand Up @@ -26585,13 +26621,15 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
(currentDecoration !== lastDecoration || currentFill !== lastFill || _size !== size || _dy !== dy)
&& boxWidth > 0
) {
lastDecoration && lastFill &&
if (lastDecoration && lastFill) {
ctx.fillStyle = lastFill;
ctx.fillRect(
leftOffset + lineLeftOffset + boxStart,
top + this.offsets[type] * size + dy,
boxWidth,
this.fontSize / 15
);
}
boxStart = charBox.left;
boxWidth = charBox.width;
lastDecoration = currentDecoration;
Expand Down Expand Up @@ -27679,8 +27717,9 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
* High level function to know the color of the cursor.
* the currentChar is the one that precedes the cursor
* Returns color (fill) of char at the current cursor
* Unused from the library, is for the end user
* @return {String} Character color (fill)
* if the text object has a pattern or gradient for filler, it will return that.
* Unused by the library, is for the end user
* @return {String | fabric.Gradient | fabric.Pattern} Character color (fill)
*/
getCurrentCharColor: function() {
var cp = this._getCurrentCharIndex();
Expand Down
2 changes: 1 addition & 1 deletion dist/fabric.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"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.3.1",
"version": "4.4.0",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
Expand Down