diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71de2525776..714eb491c78 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,33 +2,15 @@
## [3.6.3]
-backport: fix(fabric.Group): will draw shadow will call parent method. [#6116](https://github.com/fabricjs/fabric.js/pull/6116)
-backport: fix(fabric.Object): getObjectScaling takes in account rotation of objects inside groups. [#6118](https://github.com/fabricjs/fabric.js/pull/6118)
-backport: fix(fabric.Object): getObjectScaling takes in account rotation of objects inside groups. [#6118](https://github.com/fabricjs/fabric.js/pull/6118)
-
-## [4.0.0-beta.5]
-
-fix(fabric.Object): getObjectScaling takes in account rotation of objects inside groups. [#6118](https://github.com/fabricjs/fabric.js/pull/6118)
-
-## [4.0.0-beta.4]
-
-fix(fabric.Group): will draw shadow will call parent method. [#6116](https://github.com/fabricjs/fabric.js/pull/6116)
-
-## [4.0.0-beta.3]
-
-fix(controls): control offset rendering code had extras `beginPath` that would clear all but not the last of them [#6114](https://github.com/fabricjs/fabric.js/pull/6114)
-
-## [4.0.0-beta.2]
-
-fix(controls): Control.getVisibility will always receive the fabric.Object argument.
-
-## [4.0.0-beta.1]
-
-breaking: All your old control code override will not work
-breaking: `uniScaleTransform` has been renamed in `uniformScaling`, meaning changed and the default value swapped. The behaviour is unchanged, but now the description and the name match.
-breaking: LockScalingFlip with the scaling flip behaviour are missing now, maybe reimplemented later.
-breaking: Object.lockUniScaling is removed. Alternatives to get the same identical functionality with less code are being evaluated.
-breaking: Canvas.onBeforeScaleRotate is removed, developers need to migrate to the event `before:transform’
+- fix(Object): ISSUE 6196 use set('canvas') to restore canvas #6216
+- fix(fabric.IText): exitEditing won't error on missing hiddenTextarea. #6138
+- fix(fabric.Object): getObjectScaling takes in account rotation of objects inside groups. #6118
+- fix(fabric.Group): will draw shadow will call parent method. #6116
+- fix(svg_parsers): Add support for empty tags (#6169)
+- fix(SVG_export, text): Check font faces markup for objects within groups (#6195)
+- fix(svg_export): remove extra space from svg export (#6209)
+- fix(svg_import): ISSUE-6170 do not try to create missing clippath (#6210)
+- fix(fabric.Object) Adding existence check for this.canvas on object stacking mixins (#6207)
## [3.6.2]
- fix fabric.Object.toDataURL blurriness on images with odd pixel number [#6131](https://github.com/fabricjs/fabric.js/pull/6131)
diff --git a/dist/fabric.js b/dist/fabric.js
index 9161901105b..3c55bdffbd5 100644
--- a/dist/fabric.js
+++ b/dist/fabric.js
@@ -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: '3.6.2' };
+var fabric = fabric || { version: '3.6.3' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
@@ -1575,10 +1575,36 @@ fabric.CommonMethods = {
return Math.max(min, Math.min(value, max));
},
+ /**
+ * Finds the scale for the object source to fit inside the object destination,
+ * keeping aspect ratio intact.
+ * respect the total allowed area for the cache.
+ * @memberOf fabric.util
+ * @param {Object | fabric.Object} source
+ * @param {Number} source.height natural unscaled height of the object
+ * @param {Number} source.width natural unscaled width of the object
+ * @param {Object | fabric.Object} destination
+ * @param {Number} destination.height natural unscaled height of the object
+ * @param {Number} destination.width natural unscaled width of the object
+ * @return {Number} scale factor to apply to source to fit into destination
+ */
findScaleToFit: function(source, destination) {
return Math.min(destination.width / source.width, destination.height / source.height);
},
+ /**
+ * Finds the scale for the object source to cover entirely the object destination,
+ * keeping aspect ratio intact.
+ * respect the total allowed area for the cache.
+ * @memberOf fabric.util
+ * @param {Object | fabric.Object} source
+ * @param {Number} source.height natural unscaled height of the object
+ * @param {Number} source.width natural unscaled width of the object
+ * @param {Object | fabric.Object} destination
+ * @param {Number} destination.height natural unscaled height of the object
+ * @param {Number} destination.width natural unscaled width of the object
+ * @return {Number} scale factor to apply to source to cover destination
+ */
findScaleToCover: function(source, destination) {
return Math.max(destination.width / source.width, destination.height / source.height);
},
@@ -4281,8 +4307,8 @@ fabric.warn = console.warn;
// very crude parsing of style contents
for (i = 0, len = styles.length; i < len; i++) {
- // IE9 doesn't support textContent, but provides text instead.
- var styleContents = styles[i].textContent || styles[i].text;
+ // could produce `undefined`, covering this case with ''
+ var styleContents = styles[i].textContent || '';
// remove comments
styleContents = styleContents.replace(/\/\*[\s\S]*?\*\//g, '');
@@ -4530,6 +4556,10 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
clipPath.setPositionByOrigin({ x: options.translateX, y: options.translateY }, 'center', 'center');
obj.clipPath = clipPath;
}
+ else {
+ // if clip-path does not resolve to any element, delete the property.
+ delete obj.clipPath;
+ }
};
proto.checkIfDone = function() {
@@ -8046,7 +8076,14 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
createSVGFontFacesMarkup: function() {
var markup = '', fontList = { }, obj, fontFamily,
style, row, rowIndex, _char, charIndex, i, len,
- fontPaths = fabric.fontPaths, objects = this._objects;
+ fontPaths = fabric.fontPaths, objects = [];
+
+ this._objects.forEach(function add(object) {
+ objects.push(object);
+ if (object._objects) {
+ object._objects.forEach(add);
+ }
+ });
for (i = 0, len = objects.length; i < len; i++) {
obj = objects[i];
@@ -13125,6 +13162,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
/**
* Scale factor of object's controlling borders
+ * bigger number will make a thicker border
+ * border is 1, so this is basically a border tickness
+ * since there is no way to change the border itself.
* @type Number
* @default
*/
@@ -13629,6 +13669,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
strokeLineCap: this.strokeLineCap,
strokeDashOffset: this.strokeDashOffset,
strokeLineJoin: this.strokeLineJoin,
+ // TODO: add this before release
+ // strokeUniform: this.strokeUniform,
strokeMiterLimit: toFixed(this.strokeMiterLimit, NUM_FRACTION_DIGITS),
scaleX: toFixed(this.scaleX, NUM_FRACTION_DIGITS),
scaleY: toFixed(this.scaleY, NUM_FRACTION_DIGITS),
@@ -13711,13 +13753,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
* @return {Object} object with scaleX and scaleY properties
*/
getObjectScaling: function() {
- var scaleX = this.scaleX, scaleY = this.scaleY;
- if (this.group) {
- var scaling = this.group.getObjectScaling();
- scaleX *= scaling.scaleX;
- scaleY *= scaling.scaleY;
- }
- return { scaleX: scaleX, scaleY: scaleY };
+ var options = fabric.util.qrDecompose(this.calcTransformMatrix());
+ return { scaleX: Math.abs(options.scaleX), scaleY: Math.abs(options.scaleY) };
},
/**
@@ -14304,7 +14341,11 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
}
ctx.save();
- if (this.strokeUniform) {
+ if (this.strokeUniform && this.group) {
+ var scaling = this.getObjectScaling();
+ ctx.scale(1 / scaling.scaleX, 1 / scaling.scaleY);
+ }
+ else if (this.strokeUniform) {
ctx.scale(1 / this.scaleX, 1 / this.scaleY);
}
this._setLineDash(ctx, this.strokeDashArray, this._renderDashedStroke);
@@ -14466,7 +14507,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
* @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4
* @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4
* @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2
- * @return {String} Returns a data: URL containing a representation of the object in the format specified by options.format
+ * @return {HTMLCanvasElement} Returns DOM element