Skip to content

Commit

Permalink
build 361 (#6103)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur committed Jan 17, 2020
1 parent 57869bd commit 01a8dd2
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog

## [3.6.1]
- fix(gradient, text): ISSUE-6014 ISSUE-6077 support percentage gradient in text [#6090](https://github.com/fabricjs/fabric.js/pull/6090)
- fix(filters): ISSUE-6072 convolution filter is off by one [#6088](https://github.com/fabricjs/fabric.js/pull/6088)
- fix(transform): Fix a bug in the skewing logic [#6082](https://github.com/fabricjs/fabric.js/pull/6088)

## [3.6.0]
- fix: ISSUE-5512 better Clippath transform parsing in SVG [#5983](https://github.com/fabricjs/fabric.js/pull/5983)
- fix: ISSUE-5984 Avoid enter editing in non selectable object [#5989](https://github.com/fabricjs/fabric.js/pull/5989)
Expand Down
2 changes: 1 addition & 1 deletion HEADER.js
@@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: '3.6.0' };
var fabric = fabric || { version: '3.6.1' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down
60 changes: 43 additions & 17 deletions 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.0' };
var fabric = fabric || { version: '3.6.1' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand Down Expand Up @@ -6014,28 +6014,34 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
/**
* Returns an instance of CanvasGradient
* @param {CanvasRenderingContext2D} ctx Context to render on
* @param {fabric.Object} object the fabric.Object for which the gradient is
* @return {CanvasGradient}
*/
toLive: function(ctx) {
var gradient, coords = fabric.util.object.clone(this.coords), i, len;
toLive: function(ctx, object) {
var gradient, coords = fabric.util.object.clone(this.coords), i, len,
x1 = coords.x1, y1 = coords.y1, x2 = coords.x2, y2 = coords.y2,
stops = this.colorStops;

if (!this.type) {
return;
}

if (object instanceof fabric.Text && this.gradientUnits === 'percentage') {
x1 *= object.width;
y1 *= object.height;
x2 *= object.width;
y2 *= object.height;
}
if (this.type === 'linear') {
gradient = ctx.createLinearGradient(
coords.x1, coords.y1, coords.x2, coords.y2);
gradient = ctx.createLinearGradient(x1, y1, x2, y2);
}
else if (this.type === 'radial') {
gradient = ctx.createRadialGradient(
coords.x1, coords.y1, coords.r1, coords.x2, coords.y2, coords.r2);
gradient = ctx.createRadialGradient(x1, y1, coords.r1, x2, y2, coords.r2);
}

for (i = 0, len = this.colorStops.length; i < len; i++) {
var color = this.colorStops[i].color,
opacity = this.colorStops[i].opacity,
offset = this.colorStops[i].offset;
for (i = 0, len = stops.length; i < len; i++) {
var color = stops[i].color,
opacity = stops[i].opacity,
offset = stops[i].offset;

if (typeof opacity !== 'undefined') {
color = new fabric.Color(color).setAlpha(opacity).toRgba();
Expand Down Expand Up @@ -15702,8 +15708,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati

/*
* Calculate object bounding box dimensions from its properties scale, skew.
* @param {Number} skewX, a value to override current skewX
* @param {Number} skewY, a value to override current skewY
* The skewX and skewY parameters are used in the skewing logic path and
* do not provide something useful to common use cases.
* @param {Number} [skewX], a value to override current skewX
* @param {Number} [skewY], a value to override current skewY
* @private
* @return {Object} .x width dimension
* @return {Object} .y height dimension
Expand Down Expand Up @@ -15753,8 +15761,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
transformMatrix = fabric.util.calcDimensionsMatrix({
scaleX: this.scaleX,
scaleY: this.scaleY,
skewX: this.skewX,
skewY: this.skewY,
skewX: skewX,
skewY: skewY,
}),
bbox = fabric.util.makeBoundingBoxFromPoints(points, transformMatrix);
return this._finalizeDimensions(bbox.width, bbox.height);
Expand Down Expand Up @@ -22175,7 +22183,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
scx = x + cx - halfSide;

// eslint-disable-next-line max-depth
if (scy < 0 || scy > sh || scx < 0 || scx > sw) {
if (scy < 0 || scy >= sh || scx < 0 || scx >= sw) {
continue;
}

Expand Down Expand Up @@ -25627,6 +25635,24 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
return -this.height / 2;
},

/**
* @private
* @param {CanvasRenderingContext2D} ctx Context to render on
* @param {Object} filler fabric.Pattern or fabric.Gradient
* @return {Object} offset.offsetX offset for text rendering
* @return {Object} offset.offsetY offset for text rendering
*/
_applyPatternGradientTransform: function(ctx, filler) {
if (!filler || !filler.toLive) {
return { offsetX: 0, offsetY: 0 };
}
var offsetX = -this.width / 2 + filler.offsetX || 0,
offsetY = -this.height / 2 + filler.offsetY || 0;

ctx.transform(1, 0, 0, 1, offsetX, offsetY);
return { offsetX: offsetX, offsetY: offsetY };
},

/**
* @private
* @param {CanvasRenderingContext2D} ctx Context to render on
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
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.6.0",
"version": "3.6.1",
"authors": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
Expand Down

0 comments on commit 01a8dd2

Please sign in to comment.