Skip to content

Commit

Permalink
Version 3.5.0 (fabricjs#5963)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored Nov 14, 2019
1 parent 0295c44 commit d56a0a6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [3.5.0]
- Deprecation: deprecated 3 method of the api that will disappear in fabric 4: setPatternFill, setColor, setShadow.
- Fix: remove line dash modification for strokeUniform [#5953](https://github.com/fabricjs/fabric.js/pull/5953)
- Improvement: ISSUE-5955 parse svg clip-path recursively [#5960](https://github.com/fabricjs/fabric.js/pull/5960)
- Fix: object.toCanvasElement of objects in groups [#5962](https://github.com/fabricjs/fabric.js/pull/5962)
- change pencil brush finalize to be in line with other brushes [#5866](https://github.com/fabricjs/fabric.js/pull/5866)

## [3.4.0]
- Support fill-opacity on gradient parsing from SVG. [#5812](https://github.com/fabricjs/fabric.js/pull/5812)
- Rewrite gradient parsing from SVG to work with more transformation and combinations of attributes. [#5836](https://github.com/fabricjs/fabric.js/pull/5836)
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: '3.4.0' };
var fabric = fabric || { version: '3.5.0' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down
42 changes: 26 additions & 16 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: '3.4.0' };
var fabric = fabric || { version: '3.5.0' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down Expand Up @@ -1310,7 +1310,7 @@ fabric.CommonMethods = {
* @memberOf fabric.util
* @param {Object} options
* @param {Number} [options.angle] angle in degrees
* @return {Array[Number]} transform matrix
* @return {Number[]} transform matrix
*/
calcRotateMatrix: function(options) {
if (!options.angle) {
Expand All @@ -1337,7 +1337,7 @@ fabric.CommonMethods = {
* @param {Boolean} [options.flipY]
* @param {Number} [options.skewX]
* @param {Number} [options.skewX]
* @return {Array[Number]} transform matrix
* @return {Number[]} transform matrix
*/
calcDimensionsMatrix: function(options) {
var scaleX = typeof options.scaleX === 'undefined' ? 1 : options.scaleX,
Expand Down Expand Up @@ -1382,7 +1382,7 @@ fabric.CommonMethods = {
* @param {Number} [options.skewX]
* @param {Number} [options.translateX]
* @param {Number} [options.translateY]
* @return {Array[Number]} transform matrix
* @return {Number[]} transform matrix
*/
composeMatrix: function(options) {
var matrix = [1, 0, 0, 1, options.translateX || 0, options.translateY || 0],
Expand All @@ -1405,7 +1405,7 @@ fabric.CommonMethods = {
* @param {Number} scaleX
* @param {Number} scaleY
* @param {Number} skewX
* @return {Array[Number]} transform matrix
* @return {Number[]} transform matrix
*/
customTransformMatrix: function(scaleX, scaleY, skewX) {
return fabric.util.composeMatrix({ scaleX: scaleX, scaleY: scaleY, skewX: skewX });
Expand Down Expand Up @@ -4510,6 +4510,9 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
objTransformInv,
clipPath.calcTransformMatrix()
);
if (clipPath.clipPath) {
this.resolveClipPath(clipPath);
}
var options = fabric.util.qrDecompose(gTransform);
clipPath.flipX = false;
clipPath.flipY = false;
Expand Down Expand Up @@ -5788,7 +5791,7 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
* Imported from svg gradients, is not applied with the current transform in the center.
* Before this transform is applied, the origin point is at the top left corner of the object
* plus the addition of offsetY and offsetX.
* @type Array[Number]
* @type Number[]
* @default null
*/
gradientTransform: null,
Expand All @@ -5798,14 +5801,15 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
* If `pixels`, the number of coords are in the same unit of width / height.
* If set as `percentage` the coords are still a number, but 1 means 100% of width
* for the X and 100% of the height for the y. It can be bigger than 1 and negative.
* @type String pixels || percentage
* allowed values pixels or percentage.
* @type String
* @default 'pixels'
*/
gradientUnits: 'pixels',

/**
* Gradient type
* @type String linear || radial
* Gradient type linear or radial
* @type String
* @default 'pixels'
*/
type: 'linear',
Expand All @@ -5817,7 +5821,7 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
* @param {Object} [options.gradientUnits] gradient units
* @param {Object} [options.offsetX] SVG import compatibility
* @param {Object} [options.offsetY] SVG import compatibility
* @param {Array[Object]} options.colorStops contains the colorstops.
* @param {Object[]} options.colorStops contains the colorstops.
* @param {Object} options.coords contains the coords of the gradient
* @param {Number} [options.coords.x1] X coordiante of the first point for linear or of the focal point for radial
* @param {Number} [options.coords.y1] Y coordiante of the first point for linear or of the focal point for radial
Expand Down Expand Up @@ -8886,7 +8890,7 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
var path = this.createPath(pathData);
this.canvas.clearContext(this.canvas.contextTop);
this.canvas.add(path);
this.canvas.renderAll();
this.canvas.requestRenderAll();
path.setCoords();
this._resetShadow();

Expand Down Expand Up @@ -14039,9 +14043,6 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
else {
alternative && alternative(ctx);
}
if (this.strokeUniform) {
ctx.setLineDash(ctx.getLineDash().map(function(value) { return value * ctx.lineWidth; }));
}
},

/**
Expand Down Expand Up @@ -14373,9 +14374,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
options || (options = { });

var utils = fabric.util, origParams = utils.saveObjectTransform(this),
originalGroup = this.group,
originalShadow = this.shadow, abs = Math.abs,
multiplier = (options.multiplier || 1) * (options.enableRetinaScaling ? fabric.devicePixelRatio : 1);

delete this.group;
if (options.withoutTransform) {
utils.resetObjectTransform(this);
}
Expand All @@ -14397,6 +14399,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
else {
scaling = this.getObjectScaling();
}
// consider non scaling shadow.
shadowOffset.x = 2 * Math.round(abs(shadow.offsetX) + shadowBlur) * (abs(scaling.scaleX));
shadowOffset.y = 2 * Math.round(abs(shadow.offsetY) + shadowBlur) * (abs(scaling.scaleY));
}
Expand All @@ -14419,6 +14422,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
var canvasEl = canvas.toCanvasElement(multiplier || 1, options);
this.shadow = originalShadow;
this.canvas = originalCanvas;
if (originalGroup) {
this.group = originalGroup;
}
this.set(origParams).setCoords();
// canvas.dispose will call image.dispose that will nullify the elements
// since this canvas is a simple element for the process, we remove references
Expand Down Expand Up @@ -14561,6 +14567,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
* @param {Function} [callback] Callback to invoke when image set as a pattern
* @return {fabric.Object} thisArg
* @chainable
* @deprecated since 3.5.0
* @see {@link http://jsfiddle.net/fabricjs/QT3pa/|jsFiddle demo}
* @example <caption>Set pattern</caption>
* object.setPatternFill({
Expand All @@ -14581,6 +14588,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
* @param {Number} [options.offsetY=0] Shadow vertical offset
* @return {fabric.Object} thisArg
* @chainable
* @deprecated since 3.5.0
* @see {@link http://jsfiddle.net/fabricjs/7gvJG/|jsFiddle demo}
* @example <caption>Set shadow with string notation</caption>
* object.setShadow('2px 2px 10px rgba(0,0,0,0.2)');
Expand All @@ -14602,6 +14610,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
* Sets "color" of an instance (alias of `set('fill', &hellip;)`)
* @param {String} color Color value
* @return {fabric.Object} thisArg
* @deprecated since 3.5.0
* @chainable
*/
setColor: function(color) {
Expand Down Expand Up @@ -20385,7 +20394,8 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
},

/**
* @private, needed to check if image needs resize
* needed to check if image needs resize
* @private
*/
_needsResize: function() {
var scale = this.getTotalObjectScaling();
Expand Down
2 changes: 1 addition & 1 deletion dist/fabric.min.js

Large diffs are not rendered by default.

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": "3.4.0",
"version": "3.5.0",
"authors": "Juriy Zaytsev <[email protected]>",
"contributors": [
{
Expand Down

0 comments on commit d56a0a6

Please sign in to comment.