Skip to content

Commit

Permalink
v171 (#3478)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Dec 1, 2016
1 parent 8a6b17c commit 75e5a78
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 40 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
**Version 1.7.0**
**Version 1.7.1**

- Add: Gradients/Patterns support customAttributes in toObject method [#3477](https://github.com/kangax/fabric.js/pull/3477)
- Fix: IText/Textbox not blurring keyboard on ios 10 [#3476](https://github.com/kangax/fabric.js/pull/3476)
- Fix: Shadow on freedrawing and zoomed canvas [#3475](https://github.com/kangax/fabric.js/pull/3475)
- Fix: Fix for group returning negative scales [#3474](https://github.com/kangax/fabric.js/pull/3474)
- Fix: hotfix for textbox [#3441](https://github.com/kangax/fabric.js/pull/3441)[#3473](https://github.com/kangax/fabric.js/pull/3473)

**Version 1.7.0**

- Add: Object Caching [#3417](https://github.com/kangax/fabric.js/pull/3417)
- Improvement: group internal objects have coords not affected by canvas zoom [#3420](https://github.com/kangax/fabric.js/pull/3420)
Expand Down Expand Up @@ -45,7 +53,6 @@
- Fix: Error in dataURL with multiplier was outputting very big canvas with retina [#3314](https://github.com/kangax/fabric.js/pull/3314)
- Fix: Error in style map was not respecting style if textbox started with space [#3315](https://github.com/kangax/fabric.js/pull/3315)


**Version 1.6.4**

- Improvement: Ignore svg: namespace during svg import. [#3081](https://github.com/kangax/fabric.js/pull/3081)
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: "1.7.0" };
var fabric = fabric || { version: "1.7.1" };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down
39 changes: 25 additions & 14 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=json,gestures minifier=uglifyjs` */
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: "1.7.0" };
var fabric = fabric || { version: "1.7.1" };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down Expand Up @@ -5362,17 +5362,21 @@ fabric.ElementsParser.prototype.checkIfDone = function() {

/**
* Returns object representation of a gradient
* @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return {Object}
*/
toObject: function() {
return {
toObject: function(propertiesToInclude) {
var object = {
type: this.type,
coords: this.coords,
colorStops: this.colorStops,
offsetX: this.offsetX,
offsetY: this.offsetY,
gradientTransform: this.gradientTransform ? this.gradientTransform.concat() : this.gradientTransform
};
fabric.util.populateWithProperties(this, object, propertiesToInclude);

return object;
},

/* _TO_SVG_START_ */
Expand Down Expand Up @@ -5719,11 +5723,12 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */

/**
* Returns object representation of a pattern
* @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return {Object} Object representation of a pattern instance
*/
toObject: function() {
toObject: function(propertiesToInclude) {

var source;
var source, object;

// callback
if (typeof this.source === 'function') {
Expand All @@ -5738,12 +5743,15 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
source = this.source.toDataURL();
}

return {
object = {
source: source,
repeat: this.repeat,
offsetX: this.offsetX,
offsetY: this.offsetY
};
fabric.util.populateWithProperties(this, object, propertiesToInclude);

return object;
},

/* _TO_SVG_START_ */
Expand Down Expand Up @@ -7687,12 +7695,13 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
return;
}

var ctx = this.canvas.contextTop;
var ctx = this.canvas.contextTop,
zoom = this.canvas.getZoom();

ctx.shadowColor = this.shadow.color;
ctx.shadowBlur = this.shadow.blur;
ctx.shadowOffsetX = this.shadow.offsetX;
ctx.shadowOffsetY = this.shadow.offsetY;
ctx.shadowBlur = this.shadow.blur * zoom;
ctx.shadowOffsetX = this.shadow.offsetX * zoom;
ctx.shadowOffsetY = this.shadow.offsetY * zoom;
},

/**
Expand Down Expand Up @@ -18095,13 +18104,13 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
var matrix = object.calcTransformMatrix(),
options = fabric.util.qrDecompose(matrix),
center = new fabric.Point(options.translateX, options.translateY);
object.scaleX = options.scaleX;
object.scaleY = options.scaleY;
object.flipX = false;
object.flipY = false;
object.set('scaleX', options.scaleX);
object.set('scaleY', options.scaleY);
object.skewX = options.skewX;
object.skewY = options.skewY;
object.angle = options.angle;
object.flipX = false;
object.flipY = false;
object.setPositionByOrigin(center, 'center', 'center');
return object;
},
Expand Down Expand Up @@ -24117,6 +24126,7 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass(/** @lends fabric.Imag
this.selectable = true;

this.selectionEnd = this.selectionStart;
this.hiddenTextarea.blur && this.hiddenTextarea.blur();
this.hiddenTextarea && this.canvas && this.hiddenTextarea.parentNode.removeChild(this.hiddenTextarea);
this.hiddenTextarea = null;

Expand Down Expand Up @@ -25785,6 +25795,7 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
* @override
*/
_splitTextIntoLines: function(ctx) {
ctx = ctx || this.ctx;
var originalAlign = this.textAlign;
ctx.save();
this._setTextStyles(ctx);
Expand Down
16 changes: 8 additions & 8 deletions dist/fabric.min.js

Large diffs are not rendered by default.

Binary file modified dist/fabric.min.js.gz
Binary file not shown.
34 changes: 20 additions & 14 deletions dist/fabric.require.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var fabric = fabric || {
version: "1.7.0"
version: "1.7.1"
};

if (typeof exports !== "undefined") {
Expand Down Expand Up @@ -2872,15 +2872,17 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
}
return this;
},
toObject: function() {
return {
toObject: function(propertiesToInclude) {
var object = {
type: this.type,
coords: this.coords,
colorStops: this.colorStops,
offsetX: this.offsetX,
offsetY: this.offsetY,
gradientTransform: this.gradientTransform ? this.gradientTransform.concat() : this.gradientTransform
};
fabric.util.populateWithProperties(this, object, propertiesToInclude);
return object;
},
toSVG: function(object) {
var coords = fabric.util.object.clone(this.coords), markup, commonAttributes;
Expand Down Expand Up @@ -3044,21 +3046,23 @@ fabric.Pattern = fabric.util.createClass({
this.offsetY = options.offsetY;
}
},
toObject: function() {
var source;
toObject: function(propertiesToInclude) {
var source, object;
if (typeof this.source === "function") {
source = String(this.source);
} else if (typeof this.source.src === "string") {
source = this.source.src;
} else if (typeof this.source === "object" && this.source.toDataURL) {
source = this.source.toDataURL();
}
return {
object = {
source: source,
repeat: this.repeat,
offsetX: this.offsetX,
offsetY: this.offsetY
};
fabric.util.populateWithProperties(this, object, propertiesToInclude);
return object;
},
toSVG: function(object) {
var patternSource = typeof this.source === "function" ? this.source() : this.source, patternWidth = patternSource.width / object.getWidth(), patternHeight = patternSource.height / object.getHeight(), patternOffsetX = this.offsetX / object.getWidth(), patternOffsetY = this.offsetY / object.getHeight(), patternImgSrc = "";
Expand Down Expand Up @@ -3863,11 +3867,11 @@ fabric.BaseBrush = fabric.util.createClass({
if (!this.shadow) {
return;
}
var ctx = this.canvas.contextTop;
var ctx = this.canvas.contextTop, zoom = this.canvas.getZoom();
ctx.shadowColor = this.shadow.color;
ctx.shadowBlur = this.shadow.blur;
ctx.shadowOffsetX = this.shadow.offsetX;
ctx.shadowOffsetY = this.shadow.offsetY;
ctx.shadowBlur = this.shadow.blur * zoom;
ctx.shadowOffsetX = this.shadow.offsetX * zoom;
ctx.shadowOffsetY = this.shadow.offsetY * zoom;
},
_resetShadow: function() {
var ctx = this.canvas.contextTop;
Expand Down Expand Up @@ -8706,13 +8710,13 @@ fabric.util.object.extend(fabric.Object.prototype, {
},
realizeTransform: function(object) {
var matrix = object.calcTransformMatrix(), options = fabric.util.qrDecompose(matrix), center = new fabric.Point(options.translateX, options.translateY);
object.scaleX = options.scaleX;
object.scaleY = options.scaleY;
object.flipX = false;
object.flipY = false;
object.set("scaleX", options.scaleX);
object.set("scaleY", options.scaleY);
object.skewX = options.skewX;
object.skewY = options.skewY;
object.angle = options.angle;
object.flipX = false;
object.flipY = false;
object.setPositionByOrigin(center, "center", "center");
return object;
},
Expand Down Expand Up @@ -11400,6 +11404,7 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass({
this.isEditing = false;
this.selectable = true;
this.selectionEnd = this.selectionStart;
this.hiddenTextarea.blur && this.hiddenTextarea.blur();
this.hiddenTextarea && this.canvas && this.hiddenTextarea.parentNode.removeChild(this.hiddenTextarea);
this.hiddenTextarea = null;
this.abortCursorAnimation();
Expand Down Expand Up @@ -12299,6 +12304,7 @@ fabric.util.object.extend(fabric.IText.prototype, {
return lines;
},
_splitTextIntoLines: function(ctx) {
ctx = ctx || this.ctx;
var originalAlign = this.textAlign;
ctx.save();
this._setTextStyles(ctx);
Expand Down
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": "1.7.0",
"version": "1.7.1",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
Expand Down

0 comments on commit 75e5a78

Please sign in to comment.