mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-23 15:24:43 +00:00
Build distribution
This commit is contained in:
parent
2c14c18973
commit
905097149a
4 changed files with 163 additions and 111 deletions
130
dist/fabric.js
vendored
130
dist/fabric.js
vendored
|
|
@ -3347,21 +3347,36 @@ if (typeof console !== 'undefined') {
|
|||
getGradientDefs: function(doc) {
|
||||
var linearGradientEls = doc.getElementsByTagName('linearGradient'),
|
||||
radialGradientEls = doc.getElementsByTagName('radialGradient'),
|
||||
el, i,
|
||||
gradientDefs = { };
|
||||
el, i, j = 0, id, xlink, elList = [ ],
|
||||
gradientDefs = { }, idsToXlinkMap = { };
|
||||
|
||||
elList.length = linearGradientEls.length + radialGradientEls.length;
|
||||
i = linearGradientEls.length;
|
||||
for (; i--; ) {
|
||||
el = linearGradientEls[i];
|
||||
gradientDefs[el.getAttribute('id')] = el;
|
||||
while (i--) {
|
||||
elList[j++] = linearGradientEls[i];
|
||||
}
|
||||
|
||||
i = radialGradientEls.length;
|
||||
for (; i--; ) {
|
||||
el = radialGradientEls[i];
|
||||
gradientDefs[el.getAttribute('id')] = el;
|
||||
while (i--) {
|
||||
elList[j++] = radialGradientEls[i];
|
||||
}
|
||||
|
||||
while (j--) {
|
||||
el = elList[j];
|
||||
xlink = el.getAttribute('xlink:href');
|
||||
id = el.getAttribute('id');
|
||||
if (xlink) {
|
||||
idsToXlinkMap[id] = xlink.substr(1);
|
||||
}
|
||||
gradientDefs[id] = el;
|
||||
}
|
||||
|
||||
for (id in idsToXlinkMap) {
|
||||
var el2 = gradientDefs[idsToXlinkMap[id]].cloneNode(true);
|
||||
el = gradientDefs[id];
|
||||
while (el2.firstChild) {
|
||||
el.appendChild(el2.firstChild);
|
||||
}
|
||||
}
|
||||
return gradientDefs;
|
||||
},
|
||||
|
||||
|
|
@ -3702,7 +3717,8 @@ fabric.ElementsParser.prototype._createObject = function(klass, el, index) {
|
|||
}
|
||||
else {
|
||||
var obj = klass.fromElement(el, this.options);
|
||||
this.resolveGradient(obj);
|
||||
this.resolveGradient(obj, 'fill');
|
||||
this.resolveGradient(obj, 'stroke');
|
||||
this.reviver && this.reviver(el, obj);
|
||||
this.instances[index] = obj;
|
||||
this.checkIfDone();
|
||||
|
|
@ -3712,22 +3728,23 @@ fabric.ElementsParser.prototype._createObject = function(klass, el, index) {
|
|||
fabric.ElementsParser.prototype.createCallback = function(index, el) {
|
||||
var _this = this;
|
||||
return function(obj) {
|
||||
_this.resolveGradient(obj);
|
||||
_this.resolveGradient(obj, 'fill');
|
||||
_this.resolveGradient(obj, 'stroke');
|
||||
_this.reviver && _this.reviver(el, obj);
|
||||
_this.instances[index] = obj;
|
||||
_this.checkIfDone();
|
||||
};
|
||||
};
|
||||
|
||||
fabric.ElementsParser.prototype.resolveGradient = function(obj) {
|
||||
fabric.ElementsParser.prototype.resolveGradient = function(obj, property) {
|
||||
|
||||
var instanceFillValue = obj.get('fill');
|
||||
var instanceFillValue = obj.get(property);
|
||||
if (!(/^url\(/).test(instanceFillValue)) {
|
||||
return;
|
||||
}
|
||||
var gradientId = instanceFillValue.slice(5, instanceFillValue.length - 1);
|
||||
if (fabric.gradientDefs[gradientId]) {
|
||||
obj.set('fill',
|
||||
obj.set(property,
|
||||
fabric.Gradient.fromElement(fabric.gradientDefs[gradientId], obj));
|
||||
}
|
||||
};
|
||||
|
|
@ -4759,6 +4776,19 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
* @see {@link fabric.Gradient#initialize} for constructor definition
|
||||
*/
|
||||
fabric.Gradient = fabric.util.createClass(/** @lends fabric.Gradient.prototype */ {
|
||||
/*
|
||||
* Stores the original position of the gradient when we convert from % to fixed values, for objectBoundingBox case.
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
origX: 0,
|
||||
|
||||
/*
|
||||
* Stores the original position of the gradient when we convert from % to fixed values, for objectBoundingBox case.
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
origY: 0,
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -4791,6 +4821,8 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
if (options.gradientTransform) {
|
||||
this.gradientTransform = options.gradientTransform;
|
||||
}
|
||||
this.origX = options.left;
|
||||
this.orgiY = options.top;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -4832,7 +4864,7 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
*/
|
||||
toSVG: function(object, normalize) {
|
||||
var coords = fabric.util.object.clone(this.coords),
|
||||
markup;
|
||||
markup, commonAttributes;
|
||||
|
||||
// colorStops must be sorted ascending
|
||||
this.colorStops.sort(function(a, b) {
|
||||
|
|
@ -4848,18 +4880,21 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
else if (this.gradientUnits === 'objectBoundingBox') {
|
||||
_convertValuesToPercentUnits(object, coords);
|
||||
}
|
||||
|
||||
commonAttributes = 'id="SVGID_' + this.id +
|
||||
'" gradientUnits="' + this.gradientUnits + '"';
|
||||
if (this.gradientTransform) {
|
||||
commonAttributes += ' gradientTransform="matrix(' + this.gradientTransform.join(' ') + ')" ';
|
||||
}
|
||||
if (this.type === 'linear') {
|
||||
markup = [
|
||||
//jscs:disable validateIndentation
|
||||
'<linearGradient ',
|
||||
'id="SVGID_', this.id,
|
||||
'" gradientUnits="', this.gradientUnits,
|
||||
'" x1="', coords.x1,
|
||||
commonAttributes,
|
||||
' x1="', coords.x1,
|
||||
'" y1="', coords.y1,
|
||||
'" x2="', coords.x2,
|
||||
'" y2="', coords.y2,
|
||||
'">'
|
||||
'">\n'
|
||||
//jscs:enable validateIndentation
|
||||
];
|
||||
}
|
||||
|
|
@ -4867,14 +4902,13 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
markup = [
|
||||
//jscs:disable validateIndentation
|
||||
'<radialGradient ',
|
||||
'id="SVGID_', this.id,
|
||||
'" gradientUnits="', this.gradientUnits,
|
||||
'" cx="', coords.x2,
|
||||
commonAttributes,
|
||||
' cx="', coords.x2,
|
||||
'" cy="', coords.y2,
|
||||
'" r="', coords.r2,
|
||||
'" fx="', coords.x1,
|
||||
'" fy="', coords.y1,
|
||||
'">'
|
||||
'">\n'
|
||||
//jscs:enable validateIndentation
|
||||
];
|
||||
}
|
||||
|
|
@ -4885,13 +4919,13 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
'<stop ',
|
||||
'offset="', (this.colorStops[i].offset * 100) + '%',
|
||||
'" style="stop-color:', this.colorStops[i].color,
|
||||
(this.colorStops[i].opacity ? ';stop-opacity: ' + this.colorStops[i].opacity : ';'),
|
||||
'"/>'
|
||||
(this.colorStops[i].opacity != null ? ';stop-opacity: ' + this.colorStops[i].opacity : ';'),
|
||||
'"/>\n'
|
||||
//jscs:enable validateIndentation
|
||||
);
|
||||
}
|
||||
|
||||
markup.push((this.type === 'linear' ? '</linearGradient>' : '</radialGradient>'));
|
||||
markup.push((this.type === 'linear' ? '</linearGradient>\n' : '</radialGradient>\n'));
|
||||
|
||||
return markup.join('');
|
||||
},
|
||||
|
|
@ -5038,23 +5072,12 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
if (typeof options[prop] === 'string' && /^\d+%$/.test(options[prop])) {
|
||||
var percents = parseFloat(options[prop], 10);
|
||||
if (prop === 'x1' || prop === 'x2' || prop === 'r2') {
|
||||
options[prop] = fabric.util.toFixed(object.width * percents / 100, 2);
|
||||
options[prop] = fabric.util.toFixed(object.width * percents / 100, 2) + object.left;
|
||||
}
|
||||
else if (prop === 'y1' || prop === 'y2') {
|
||||
options[prop] = fabric.util.toFixed(object.height * percents / 100, 2);
|
||||
options[prop] = fabric.util.toFixed(object.height * percents / 100, 2) + object.top;
|
||||
}
|
||||
}
|
||||
normalize(options, prop, object);
|
||||
}
|
||||
}
|
||||
|
||||
// normalize rendering point (should be from top/left corner rather than center of the shape)
|
||||
function normalize(options, prop, object) {
|
||||
if (prop === 'x1' || prop === 'x2') {
|
||||
options[prop] -= fabric.util.toFixed(object.width / 2, 2);
|
||||
}
|
||||
else if (prop === 'y1' || prop === 'y2') {
|
||||
options[prop] -= fabric.util.toFixed(object.height / 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5064,15 +5087,12 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
*/
|
||||
function _convertValuesToPercentUnits(object, options) {
|
||||
for (var prop in options) {
|
||||
|
||||
normalize(options, prop, object);
|
||||
|
||||
// convert to percent units
|
||||
//convert to percent units
|
||||
if (prop === 'x1' || prop === 'x2' || prop === 'r2') {
|
||||
options[prop] = fabric.util.toFixed(options[prop] / object.width * 100, 2) + '%';
|
||||
options[prop] = fabric.util.toFixed((options[prop] - object.origX) / object.width * 100, 2) + '%';
|
||||
}
|
||||
else if (prop === 'y1' || prop === 'y2') {
|
||||
options[prop] = fabric.util.toFixed(options[prop] / object.height * 100, 2) + '%';
|
||||
options[prop] = fabric.util.toFixed((options[prop] - object.origY) / object.height * 100, 2) + '%';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11164,7 +11184,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
ctx.translate(-this.group.width/2, -this.group.height/2);
|
||||
var m = this.transformMatrix;
|
||||
if (m) {
|
||||
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
ctx.transform.apply(ctx, m);
|
||||
}
|
||||
}
|
||||
ctx.globalAlpha = this.group ? (ctx.globalAlpha * this.opacity) : this.opacity;
|
||||
|
|
@ -11182,7 +11202,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
var m = this.transformMatrix;
|
||||
|
||||
if (m && !this.group) {
|
||||
ctx.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
ctx.setTransform.apply(ctx, m);
|
||||
}
|
||||
if (!noTransform) {
|
||||
this.transform(ctx);
|
||||
|
|
@ -11275,21 +11295,23 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
return;
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
if (this.fill.toLive) {
|
||||
ctx.save();
|
||||
ctx.translate(
|
||||
-this.width / 2 + this.fill.offsetX || 0,
|
||||
-this.height / 2 + this.fill.offsetY || 0);
|
||||
}
|
||||
if (this.fill.gradientTransform) {
|
||||
var g = this.fill.gradientTransform;
|
||||
ctx.transform.apply(ctx, g);
|
||||
}
|
||||
if (this.fillRule === 'destination-over') {
|
||||
ctx.fill('evenodd');
|
||||
}
|
||||
else {
|
||||
ctx.fill();
|
||||
}
|
||||
if (this.fill.toLive) {
|
||||
ctx.restore();
|
||||
}
|
||||
ctx.restore();
|
||||
if (this.shadow && !this.shadow.affectStroke) {
|
||||
this._removeShadow(ctx);
|
||||
}
|
||||
|
|
@ -11321,6 +11343,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
ctx.stroke();
|
||||
}
|
||||
else {
|
||||
if (this.stroke.gradientTransform) {
|
||||
var g = this.stroke.gradientTransform;
|
||||
ctx.transform.apply(ctx, g);
|
||||
}
|
||||
this._stroke ? this._stroke(ctx) : ctx.stroke();
|
||||
}
|
||||
this._removeShadow(ctx);
|
||||
|
|
|
|||
14
dist/fabric.min.js
vendored
14
dist/fabric.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/fabric.min.js.gz
vendored
BIN
dist/fabric.min.js.gz
vendored
Binary file not shown.
130
dist/fabric.require.js
vendored
130
dist/fabric.require.js
vendored
|
|
@ -3347,21 +3347,36 @@ if (typeof console !== 'undefined') {
|
|||
getGradientDefs: function(doc) {
|
||||
var linearGradientEls = doc.getElementsByTagName('linearGradient'),
|
||||
radialGradientEls = doc.getElementsByTagName('radialGradient'),
|
||||
el, i,
|
||||
gradientDefs = { };
|
||||
el, i, j = 0, id, xlink, elList = [ ],
|
||||
gradientDefs = { }, idsToXlinkMap = { };
|
||||
|
||||
elList.length = linearGradientEls.length + radialGradientEls.length;
|
||||
i = linearGradientEls.length;
|
||||
for (; i--; ) {
|
||||
el = linearGradientEls[i];
|
||||
gradientDefs[el.getAttribute('id')] = el;
|
||||
while (i--) {
|
||||
elList[j++] = linearGradientEls[i];
|
||||
}
|
||||
|
||||
i = radialGradientEls.length;
|
||||
for (; i--; ) {
|
||||
el = radialGradientEls[i];
|
||||
gradientDefs[el.getAttribute('id')] = el;
|
||||
while (i--) {
|
||||
elList[j++] = radialGradientEls[i];
|
||||
}
|
||||
|
||||
while (j--) {
|
||||
el = elList[j];
|
||||
xlink = el.getAttribute('xlink:href');
|
||||
id = el.getAttribute('id');
|
||||
if (xlink) {
|
||||
idsToXlinkMap[id] = xlink.substr(1);
|
||||
}
|
||||
gradientDefs[id] = el;
|
||||
}
|
||||
|
||||
for (id in idsToXlinkMap) {
|
||||
var el2 = gradientDefs[idsToXlinkMap[id]].cloneNode(true);
|
||||
el = gradientDefs[id];
|
||||
while (el2.firstChild) {
|
||||
el.appendChild(el2.firstChild);
|
||||
}
|
||||
}
|
||||
return gradientDefs;
|
||||
},
|
||||
|
||||
|
|
@ -3702,7 +3717,8 @@ fabric.ElementsParser.prototype._createObject = function(klass, el, index) {
|
|||
}
|
||||
else {
|
||||
var obj = klass.fromElement(el, this.options);
|
||||
this.resolveGradient(obj);
|
||||
this.resolveGradient(obj, 'fill');
|
||||
this.resolveGradient(obj, 'stroke');
|
||||
this.reviver && this.reviver(el, obj);
|
||||
this.instances[index] = obj;
|
||||
this.checkIfDone();
|
||||
|
|
@ -3712,22 +3728,23 @@ fabric.ElementsParser.prototype._createObject = function(klass, el, index) {
|
|||
fabric.ElementsParser.prototype.createCallback = function(index, el) {
|
||||
var _this = this;
|
||||
return function(obj) {
|
||||
_this.resolveGradient(obj);
|
||||
_this.resolveGradient(obj, 'fill');
|
||||
_this.resolveGradient(obj, 'stroke');
|
||||
_this.reviver && _this.reviver(el, obj);
|
||||
_this.instances[index] = obj;
|
||||
_this.checkIfDone();
|
||||
};
|
||||
};
|
||||
|
||||
fabric.ElementsParser.prototype.resolveGradient = function(obj) {
|
||||
fabric.ElementsParser.prototype.resolveGradient = function(obj, property) {
|
||||
|
||||
var instanceFillValue = obj.get('fill');
|
||||
var instanceFillValue = obj.get(property);
|
||||
if (!(/^url\(/).test(instanceFillValue)) {
|
||||
return;
|
||||
}
|
||||
var gradientId = instanceFillValue.slice(5, instanceFillValue.length - 1);
|
||||
if (fabric.gradientDefs[gradientId]) {
|
||||
obj.set('fill',
|
||||
obj.set(property,
|
||||
fabric.Gradient.fromElement(fabric.gradientDefs[gradientId], obj));
|
||||
}
|
||||
};
|
||||
|
|
@ -4759,6 +4776,19 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
* @see {@link fabric.Gradient#initialize} for constructor definition
|
||||
*/
|
||||
fabric.Gradient = fabric.util.createClass(/** @lends fabric.Gradient.prototype */ {
|
||||
/*
|
||||
* Stores the original position of the gradient when we convert from % to fixed values, for objectBoundingBox case.
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
origX: 0,
|
||||
|
||||
/*
|
||||
* Stores the original position of the gradient when we convert from % to fixed values, for objectBoundingBox case.
|
||||
* @type Number
|
||||
* @default 0
|
||||
*/
|
||||
origY: 0,
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -4791,6 +4821,8 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
if (options.gradientTransform) {
|
||||
this.gradientTransform = options.gradientTransform;
|
||||
}
|
||||
this.origX = options.left;
|
||||
this.orgiY = options.top;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -4832,7 +4864,7 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
*/
|
||||
toSVG: function(object, normalize) {
|
||||
var coords = fabric.util.object.clone(this.coords),
|
||||
markup;
|
||||
markup, commonAttributes;
|
||||
|
||||
// colorStops must be sorted ascending
|
||||
this.colorStops.sort(function(a, b) {
|
||||
|
|
@ -4848,18 +4880,21 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
else if (this.gradientUnits === 'objectBoundingBox') {
|
||||
_convertValuesToPercentUnits(object, coords);
|
||||
}
|
||||
|
||||
commonAttributes = 'id="SVGID_' + this.id +
|
||||
'" gradientUnits="' + this.gradientUnits + '"';
|
||||
if (this.gradientTransform) {
|
||||
commonAttributes += ' gradientTransform="matrix(' + this.gradientTransform.join(' ') + ')" ';
|
||||
}
|
||||
if (this.type === 'linear') {
|
||||
markup = [
|
||||
//jscs:disable validateIndentation
|
||||
'<linearGradient ',
|
||||
'id="SVGID_', this.id,
|
||||
'" gradientUnits="', this.gradientUnits,
|
||||
'" x1="', coords.x1,
|
||||
commonAttributes,
|
||||
' x1="', coords.x1,
|
||||
'" y1="', coords.y1,
|
||||
'" x2="', coords.x2,
|
||||
'" y2="', coords.y2,
|
||||
'">'
|
||||
'">\n'
|
||||
//jscs:enable validateIndentation
|
||||
];
|
||||
}
|
||||
|
|
@ -4867,14 +4902,13 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
markup = [
|
||||
//jscs:disable validateIndentation
|
||||
'<radialGradient ',
|
||||
'id="SVGID_', this.id,
|
||||
'" gradientUnits="', this.gradientUnits,
|
||||
'" cx="', coords.x2,
|
||||
commonAttributes,
|
||||
' cx="', coords.x2,
|
||||
'" cy="', coords.y2,
|
||||
'" r="', coords.r2,
|
||||
'" fx="', coords.x1,
|
||||
'" fy="', coords.y1,
|
||||
'">'
|
||||
'">\n'
|
||||
//jscs:enable validateIndentation
|
||||
];
|
||||
}
|
||||
|
|
@ -4885,13 +4919,13 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
'<stop ',
|
||||
'offset="', (this.colorStops[i].offset * 100) + '%',
|
||||
'" style="stop-color:', this.colorStops[i].color,
|
||||
(this.colorStops[i].opacity ? ';stop-opacity: ' + this.colorStops[i].opacity : ';'),
|
||||
'"/>'
|
||||
(this.colorStops[i].opacity != null ? ';stop-opacity: ' + this.colorStops[i].opacity : ';'),
|
||||
'"/>\n'
|
||||
//jscs:enable validateIndentation
|
||||
);
|
||||
}
|
||||
|
||||
markup.push((this.type === 'linear' ? '</linearGradient>' : '</radialGradient>'));
|
||||
markup.push((this.type === 'linear' ? '</linearGradient>\n' : '</radialGradient>\n'));
|
||||
|
||||
return markup.join('');
|
||||
},
|
||||
|
|
@ -5038,23 +5072,12 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
if (typeof options[prop] === 'string' && /^\d+%$/.test(options[prop])) {
|
||||
var percents = parseFloat(options[prop], 10);
|
||||
if (prop === 'x1' || prop === 'x2' || prop === 'r2') {
|
||||
options[prop] = fabric.util.toFixed(object.width * percents / 100, 2);
|
||||
options[prop] = fabric.util.toFixed(object.width * percents / 100, 2) + object.left;
|
||||
}
|
||||
else if (prop === 'y1' || prop === 'y2') {
|
||||
options[prop] = fabric.util.toFixed(object.height * percents / 100, 2);
|
||||
options[prop] = fabric.util.toFixed(object.height * percents / 100, 2) + object.top;
|
||||
}
|
||||
}
|
||||
normalize(options, prop, object);
|
||||
}
|
||||
}
|
||||
|
||||
// normalize rendering point (should be from top/left corner rather than center of the shape)
|
||||
function normalize(options, prop, object) {
|
||||
if (prop === 'x1' || prop === 'x2') {
|
||||
options[prop] -= fabric.util.toFixed(object.width / 2, 2);
|
||||
}
|
||||
else if (prop === 'y1' || prop === 'y2') {
|
||||
options[prop] -= fabric.util.toFixed(object.height / 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5064,15 +5087,12 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
|
|||
*/
|
||||
function _convertValuesToPercentUnits(object, options) {
|
||||
for (var prop in options) {
|
||||
|
||||
normalize(options, prop, object);
|
||||
|
||||
// convert to percent units
|
||||
//convert to percent units
|
||||
if (prop === 'x1' || prop === 'x2' || prop === 'r2') {
|
||||
options[prop] = fabric.util.toFixed(options[prop] / object.width * 100, 2) + '%';
|
||||
options[prop] = fabric.util.toFixed((options[prop] - object.origX) / object.width * 100, 2) + '%';
|
||||
}
|
||||
else if (prop === 'y1' || prop === 'y2') {
|
||||
options[prop] = fabric.util.toFixed(options[prop] / object.height * 100, 2) + '%';
|
||||
options[prop] = fabric.util.toFixed((options[prop] - object.origY) / object.height * 100, 2) + '%';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11164,7 +11184,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
ctx.translate(-this.group.width/2, -this.group.height/2);
|
||||
var m = this.transformMatrix;
|
||||
if (m) {
|
||||
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
ctx.transform.apply(ctx, m);
|
||||
}
|
||||
}
|
||||
ctx.globalAlpha = this.group ? (ctx.globalAlpha * this.opacity) : this.opacity;
|
||||
|
|
@ -11182,7 +11202,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
var m = this.transformMatrix;
|
||||
|
||||
if (m && !this.group) {
|
||||
ctx.setTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
ctx.setTransform.apply(ctx, m);
|
||||
}
|
||||
if (!noTransform) {
|
||||
this.transform(ctx);
|
||||
|
|
@ -11275,21 +11295,23 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
return;
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
if (this.fill.toLive) {
|
||||
ctx.save();
|
||||
ctx.translate(
|
||||
-this.width / 2 + this.fill.offsetX || 0,
|
||||
-this.height / 2 + this.fill.offsetY || 0);
|
||||
}
|
||||
if (this.fill.gradientTransform) {
|
||||
var g = this.fill.gradientTransform;
|
||||
ctx.transform.apply(ctx, g);
|
||||
}
|
||||
if (this.fillRule === 'destination-over') {
|
||||
ctx.fill('evenodd');
|
||||
}
|
||||
else {
|
||||
ctx.fill();
|
||||
}
|
||||
if (this.fill.toLive) {
|
||||
ctx.restore();
|
||||
}
|
||||
ctx.restore();
|
||||
if (this.shadow && !this.shadow.affectStroke) {
|
||||
this._removeShadow(ctx);
|
||||
}
|
||||
|
|
@ -11321,6 +11343,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|||
ctx.stroke();
|
||||
}
|
||||
else {
|
||||
if (this.stroke.gradientTransform) {
|
||||
var g = this.stroke.gradientTransform;
|
||||
ctx.transform.apply(ctx, g);
|
||||
}
|
||||
this._stroke ? this._stroke(ctx) : ctx.stroke();
|
||||
}
|
||||
this._removeShadow(ctx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue