diff --git a/CHANGELOG.md b/CHANGELOG.md index 585fcaabedb..2f27cdfc7e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) @@ -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) diff --git a/HEADER.js b/HEADER.js index b5b1a49b90a..6dde21bd31a 100644 --- a/HEADER.js +++ b/HEADER.js @@ -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; } diff --git a/dist/fabric.js b/dist/fabric.js index 6734526c962..f6506401a5b 100644 --- a/dist/fabric.js +++ b/dist/fabric.js @@ -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; } @@ -5362,10 +5362,11 @@ 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, @@ -5373,6 +5374,9 @@ fabric.ElementsParser.prototype.checkIfDone = function() { offsetY: this.offsetY, gradientTransform: this.gradientTransform ? this.gradientTransform.concat() : this.gradientTransform }; + fabric.util.populateWithProperties(this, object, propertiesToInclude); + + return object; }, /* _TO_SVG_START_ */ @@ -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') { @@ -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_ */ @@ -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; }, /** @@ -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; }, @@ -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; @@ -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); diff --git a/dist/fabric.min.js b/dist/fabric.min.js index 0295c0ed746..457f1d4cb06 100644 --- a/dist/fabric.min.js +++ b/dist/fabric.min.js @@ -1,8 +1,8 @@ -var fabric=fabric||{version:"1.7.0"};"undefined"!=typeof exports&&(exports.fabric=fabric),"undefined"!=typeof document&&"undefined"!=typeof window?(fabric.document=document,fabric.window=window,window.fabric=fabric):(fabric.document=require("jsdom").jsdom("
"),fabric.document.createWindow?fabric.window=fabric.document.createWindow():fabric.window=fabric.document.parentWindow),fabric.isTouchSupported="ontouchstart"in fabric.document.documentElement,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id"],fabric.DPI=96,fabric.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)",fabric.fontPaths={},fabric.charWidthsCache={},fabric.devicePixelRatio=fabric.window.devicePixelRatio||fabric.window.webkitDevicePixelRatio||fabric.window.mozDevicePixelRatio||1,function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:fabric.util.array.fill(i,!1)}}function e(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this}function i(e,i){if(this.__eventListeners){if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"==typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,i);return this}}function r(t,e){if(this.__eventListeners){var i=this.__eventListeners[t];if(i){for(var r=0,n=i.length;r