mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-22 20:25:49 +00:00
Fix "stroke-width" being ignored in style attribute.
This commit is contained in:
parent
1da65cbead
commit
b701627f42
6 changed files with 27 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.8.16" };
|
||||
var fabric = fabric || { version: "0.8.17" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
|
|||
19
dist/all.js
vendored
19
dist/all.js
vendored
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.8.16" };
|
||||
var fabric = fabric || { version: "0.8.17" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
@ -3177,6 +3177,14 @@ fabric.util.string = {
|
|||
'transform': 'transformMatrix'
|
||||
};
|
||||
|
||||
function normalizeAttr(attr) {
|
||||
// transform attribute names
|
||||
if (attr in attributesMap) {
|
||||
return attributesMap[attr];
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object of attributes' name/value, given element and an array of attribute names;
|
||||
* Parses parent "g" nodes recursively upwards.
|
||||
|
|
@ -3216,10 +3224,7 @@ fabric.util.string = {
|
|||
if (attr === 'transform') {
|
||||
value = fabric.parseTransformAttribute(value);
|
||||
}
|
||||
// transform attribute names
|
||||
if (attr in attributesMap) {
|
||||
attr = attributesMap[attr];
|
||||
}
|
||||
attr = normalizeAttr(attr);
|
||||
memo[attr] = isNaN(parsed) ? value : parsed;
|
||||
}
|
||||
return memo;
|
||||
|
|
@ -3421,12 +3426,12 @@ fabric.util.string = {
|
|||
if (typeof style == 'string') {
|
||||
style = style.replace(/;$/, '').split(';').forEach(function (current) {
|
||||
var attr = current.split(':');
|
||||
oStyle[attr[0].trim().toLowerCase()] = attr[1].trim();
|
||||
oStyle[normalizeAttr(attr[0].trim().toLowerCase())] = attr[1].trim();
|
||||
});
|
||||
} else {
|
||||
for (var prop in style) {
|
||||
if (typeof style[prop] !== 'undefined') {
|
||||
oStyle[prop.toLowerCase()] = style[prop];
|
||||
oStyle[normalizeAttr(prop.toLowerCase())] = style[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
dist/all.min.js
vendored
4
dist/all.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/all.min.js.gz
vendored
BIN
dist/all.min.js.gz
vendored
Binary file not shown.
|
|
@ -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.8.16",
|
||||
"version": "0.8.17",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||
"repository": "git://github.com/kangax/fabric.js",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@
|
|||
'transform': 'transformMatrix'
|
||||
};
|
||||
|
||||
function normalizeAttr(attr) {
|
||||
// transform attribute names
|
||||
if (attr in attributesMap) {
|
||||
return attributesMap[attr];
|
||||
}
|
||||
return attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object of attributes' name/value, given element and an array of attribute names;
|
||||
* Parses parent "g" nodes recursively upwards.
|
||||
|
|
@ -63,10 +71,7 @@
|
|||
if (attr === 'transform') {
|
||||
value = fabric.parseTransformAttribute(value);
|
||||
}
|
||||
// transform attribute names
|
||||
if (attr in attributesMap) {
|
||||
attr = attributesMap[attr];
|
||||
}
|
||||
attr = normalizeAttr(attr);
|
||||
memo[attr] = isNaN(parsed) ? value : parsed;
|
||||
}
|
||||
return memo;
|
||||
|
|
@ -268,12 +273,12 @@
|
|||
if (typeof style == 'string') {
|
||||
style = style.replace(/;$/, '').split(';').forEach(function (current) {
|
||||
var attr = current.split(':');
|
||||
oStyle[attr[0].trim().toLowerCase()] = attr[1].trim();
|
||||
oStyle[normalizeAttr(attr[0].trim().toLowerCase())] = attr[1].trim();
|
||||
});
|
||||
} else {
|
||||
for (var prop in style) {
|
||||
if (typeof style[prop] !== 'undefined') {
|
||||
oStyle[prop.toLowerCase()] = style[prop];
|
||||
oStyle[normalizeAttr(prop.toLowerCase())] = style[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue