Skip to content

Commit

Permalink
v236 (#5180)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Aug 20, 2018
1 parent e8a5ad4 commit 7895099
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
**Version 2.3.6**
- Fix: Make image.class aware of naturalWidth and naturalHeight. [#5178](https://github.com/fabricjs/fabric.js/pull/5178)
- Fix: Make 2 finger events works again [#5177](https://github.com/fabricjs/fabric.js/pull/5177)
- Fix: Make Groups respect origin and correct position ( fix spray/circle brushes ) [#5176](https://github.com/fabricjs/fabric.js/pull/5176)

**Version 2.3.5**
- Change: make canvas.getObjects() always return a shallow copy of the array [#5162](https://github.com/fabricjs/fabric.js/pull/5162)
- Fix: Improve fabric.Pattern.toSVG to look correct on offsets and no-repeat [#5164](https://github.com/fabricjs/fabric.js/pull/5164)
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.3.5' };
var fabric = fabric || { version: '2.3.6' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down
55 changes: 32 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.3.5' };
var fabric = fabric || { version: '2.3.6' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down Expand Up @@ -6575,7 +6575,10 @@ fabric.ElementsParser.prototype.checkIfDone = function() {

/**
* Function that determines clipping of entire canvas area
* Being passed context as first argument. See clipping canvas area in {@link https://github.com/kangax/fabric.js/wiki/FAQ}
* 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
Expand Down Expand Up @@ -8746,7 +8749,7 @@ fabric.CircleBrush = fabric.util.createClass(fabric.BaseBrush, /** @lends fabric

circles.push(circle);
}
var group = new fabric.Group(circles, { originX: 'center', originY: 'center' });
var group = new fabric.Group(circles);
group.canvas = this.canvas;

this.canvas.add(group);
Expand Down Expand Up @@ -8893,7 +8896,7 @@ fabric.SprayBrush = fabric.util.createClass( fabric.BaseBrush, /** @lends fabric
rects = this._getOptimizedRects(rects);
}

var group = new fabric.Group(rects, { originX: 'center', originY: 'center' });
var group = new fabric.Group(rects);
this.shadow && group.setShadow(this.shadow);
this.canvas.add(group);
this.canvas.fire('path:created', { path: group });
Expand Down Expand Up @@ -12702,7 +12705,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
includeDefaultValues: true,

/**
* Function that determines clipping of an object (context is passed as a first argument)
* Function that determines clipping of an object (context is passed as a 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;
* Note that context origin is at the object's center point (not left/top corner)
* @deprecated since 2.0.0
* @type Function
Expand Down Expand Up @@ -18457,6 +18462,16 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot

if (!isAlreadyGrouped) {
var center = options && options.centerPoint;
// we want to set origins before calculating the bounding box.
// so that the topleft can be set with that in mind.
// if specific top and left are passed, are overwritten later
// with the callSuper('initialize', options)
if (options.originX !== undefined) {
this.originX = options.originX;
}
if (options.originY !== undefined) {
this.originY = options.originY;
}
// if coming from svg i do not want to calc bounds.
// i assume width and height are passed along options
center || this._calcBounds();
Expand Down Expand Up @@ -18874,6 +18889,8 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
this.width = width;
this.height = height;
if (!onlyWidthHeight) {
// the bounding box always finds the topleft most corner.
// whatever is the group origin, we set up here the left/top position.
this.setPositionByOrigin({ x: left, y: top }, 'left', 'top');
}
},
Expand Down Expand Up @@ -19231,7 +19248,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
* @return {HTMLImageElement} Image element
*/
getElement: function() {
return this._element;
return this._element || {};
},

/**
Expand Down Expand Up @@ -19300,8 +19317,8 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
getOriginalSize: function() {
var element = this.getElement();
return {
width: element.width,
height: element.height
width: element.naturalWidth || element.width,
height: element.naturalHeight || element.height
};
},

Expand Down Expand Up @@ -19606,10 +19623,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
* @private
*/
_resetWidthHeight: function() {
var element = this.getElement();

this.set('width', element.width);
this.set('height', element.height);
this.set(this.getOriginalSize());
},

/**
Expand Down Expand Up @@ -19655,20 +19669,15 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot

/**
* @private
* Set the width and the height of the image object, using the element or the
* options.
* @param {Object} [options] Object with width/height properties
*/
_setWidthHeight: function(options) {
this.width = options && ('width' in options)
? options.width
: (this.getElement()
? this.getElement().width || 0
: 0);

this.height = options && ('height' in options)
? options.height
: (this.getElement()
? this.getElement().height || 0
: 0);
options || (options = { });
var el = this.getElement();
this.width = options.width || el.naturalWidth || el.width || 0;
this.height = options.height || el.naturalHeight || el.height || 0;
},

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

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions 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": "2.3.5",
"version": "2.3.6",
"author": "Juriy Zaytsev <[email protected]>",
"contributors": [
{
Expand Down Expand Up @@ -33,10 +33,10 @@
},
"repository": {
"type": "git",
"url": "https://github.com/kangax/fabric.js"
"url": "https://github.com/fabric/fabric.js"
},
"bugs": {
"url": "https://github.com/kangax/fabric.js/issues"
"url": "https://github.com/fabric/fabric.js/issues"
},
"license": "MIT",
"scripts": {
Expand All @@ -53,7 +53,7 @@
"lint_tests": "eslint test/unit --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",
"all": "npm run build && npm run test && npm run lint && npm run lint_tests && npm run export_dist_to_site && npm run export_tests_to_site",
"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"
Expand Down

0 comments on commit 7895099

Please sign in to comment.