Fix parsing of gradients with stops that have absolute values (rather than percents).

This commit is contained in:
kangax 2012-01-21 13:33:49 -05:00
parent c057b8b6d5
commit 4565e0dd6a
6 changed files with 13 additions and 7 deletions

View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.7.12" };
var fabric = fabric || { version: "0.7.13" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;

7
dist/all.js vendored
View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.7.12" };
var fabric = fabric || { version: "0.7.13" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;
@ -3693,7 +3693,10 @@ fabric.util.string = {
for (var i = colorStopEls.length; i--; ) {
el = colorStopEls[i];
offset = parseInt(el.getAttribute('offset'), 10) / 100;
offset = el.getAttribute('offset');
// convert percents to absolute values
offset = parseFloat(offset) / (/%$/.test(offset) ? 100 : 1);
colorStops[offset] = getColorStopFromStyle(el) || el.getAttribute('stop-color');
}

4
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -1,7 +1,7 @@
{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "0.7.12",
"version": "0.7.13",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
"repository": "git://github.com/kangax/fabric.js",

View file

@ -83,7 +83,10 @@
for (var i = colorStopEls.length; i--; ) {
el = colorStopEls[i];
offset = parseInt(el.getAttribute('offset'), 10) / 100;
offset = el.getAttribute('offset');
// convert percents to absolute values
offset = parseFloat(offset) / (/%$/.test(offset) ? 100 : 1);
colorStops[offset] = getColorStopFromStyle(el) || el.getAttribute('stop-color');
}