Skip to content

Commit

Permalink
built 243 (fabricjs#5353)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Oct 28, 2018
1 parent 861dc29 commit e805e01
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [2.4.3]
- Fix: Shift click and onSelect function [#5348](https://github.com/fabricjs/fabric.js/pull/5348)
- Fix: Load from Json from images with filters and resize filters [#5346](https://github.com/fabricjs/fabric.js/pull/5346)
- Fix: Remove special case of 1x1 rect [#5345](https://github.com/fabricjs/fabric.js/pull/5345)
- Fix: Group with clipPath restore [#5344](https://github.com/fabricjs/fabric.js/pull/5344)
- Fix: Fix shift + click interaction with unselectable objects [#5324](https://github.com/fabricjs/fabric.js/pull/5324)

## [2.4.2]
- Fix: Better toSVG support to enable clipPath [#5284](https://github.com/fabricjs/fabric.js/pull/5284)
- Fix: Per pixel target find and groups and sub targets [#5287](https://github.com/fabricjs/fabric.js/pull/5287)
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: '2.4.2' };
var fabric = fabric || { version: '2.4.3' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down
49 changes: 26 additions & 23 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: '2.4.2' };
var fabric = fabric || { version: '2.4.3' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down Expand Up @@ -1178,7 +1178,7 @@ fabric.CommonMethods = {
* @return {CanvasElement} initialized canvas element
*/
copyCanvasElement: function(canvas) {
var newCanvas = fabric.document.createElement('canvas');
var newCanvas = fabric.util.createCanvasElement();
newCanvas.width = canvas.width;
newCanvas.height = canvas.height;
newCanvas.getContext('2d').drawImage(canvas, 0, 0);
Expand Down Expand Up @@ -10422,10 +10422,9 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
// until we call this function specifically to search inside the activeGroup
while (i--) {
var objToCheck = objects[i];
if (this._checkTarget(objToCheck.group && objToCheck.group.type !== 'activeSelection'
? this._normalizePointer(objToCheck.group, pointer)
: pointer,
objToCheck, pointer)) {
var pointerToUse = objToCheck.group && objToCheck.group.type !== 'activeSelection' ?
this._normalizePointer(objToCheck.group, pointer) : pointer;
if (this._checkTarget(pointerToUse, objToCheck, pointer)) {
target = objects[i];
if (target.subTargetCheck && target instanceof fabric.Group) {
subTarget = this._searchPossibleTargets(target._objects, pointer);
Expand Down Expand Up @@ -11902,9 +11901,8 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
*/
_shouldGroup: function(e, target) {
var activeObject = this._activeObject;

return activeObject && this._isSelectionKeyPressed(e) && target && target.selectable && this.selection &&
(activeObject !== target || activeObject.type === 'activeSelection');
(activeObject !== target || activeObject.type === 'activeSelection') && !target.onSelect({ e: e });
},

/**
Expand All @@ -11914,14 +11912,15 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
*/
_handleGrouping: function (e, target) {
var activeObject = this._activeObject;
// avoid multi select when shift click on a corner
if (activeObject.__corner) {
return;
}
if (target === activeObject) {
// if it's a group, find target again, using activeGroup objects
target = this.findTarget(e, true);
// if even object is not found or we are on activeObjectCorner, bail out
if (!target) {
if (!target || !target.selectable) {
return;
}
}
Expand Down Expand Up @@ -11986,7 +11985,7 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
*/
_groupSelectedObjects: function (e) {

var group = this._collectObjects(),
var group = this._collectObjects(e),
aGroup;

// do not create group for 1 element only
Expand All @@ -12004,7 +12003,7 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
/**
* @private
*/
_collectObjects: function() {
_collectObjects: function(e) {
var group = [],
currentObject,
x1 = this._groupSelector.ex,
Expand All @@ -12019,7 +12018,7 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
for (var i = this._objects.length; i--; ) {
currentObject = this._objects[i];

if (!currentObject || !currentObject.selectable || !currentObject.visible) {
if (!currentObject || !currentObject.selectable || !currentObject.visible || currentObject.onSelect({ e: e })) {
continue;
}

Expand Down Expand Up @@ -17247,11 +17246,8 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
*/
_render: function(ctx) {

// optimize 1x1 case (used in spray brush)
if (this.width === 1 && this.height === 1) {
ctx.fillRect(-0.5, -0.5, 1, 1);
return;
}
// 1x1 case (used in spray brush) optimization was removed because
// with caching and higher zoom level this makes more damage than help

var rx = this.rx ? Math.min(this.rx, this.width / 2) : 0,
ry = this.ry ? Math.min(this.ry, this.height / 2) : 0,
Expand Down Expand Up @@ -19208,9 +19204,12 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
*/
fabric.Group.fromObject = function(object, callback) {
fabric.util.enlivenObjects(object.objects, function(enlivenedObjects) {
var options = fabric.util.object.clone(object, true);
delete options.objects;
callback && callback(new fabric.Group(enlivenedObjects, options, true));
fabric.util.enlivenObjects([object.clipPath], function(enlivedClipPath) {
var options = fabric.util.object.clone(object, true);
options.clipPath = enlivedClipPath[0];
delete options.objects;
callback && callback(new fabric.Group(enlivenedObjects, options, true));
});
});
};

Expand Down Expand Up @@ -19532,12 +19531,16 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
this._element = element;
this._originalElement = element;
this._initConfig(options);
if (this.resizeFilter) {
this.applyResizeFilters();
}
if (this.filters.length !== 0) {
this.applyFilters();
}
// resizeFilters work on the already filtered copy.
// we need to apply resizeFilters AFTER normal filters.
// applyResizeFilters is run more often than normal fiters
// and is triggered by user interactions rather than dev code
if (this.resizeFilter) {
this.applyResizeFilters();
}
return this;
},

Expand Down
2 changes: 1 addition & 1 deletion dist/fabric.min.js

Large diffs are not rendered by default.

0 comments on commit e805e01

Please sign in to comment.