simplified getPaint()

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2427 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Bruno Heridet
2013-02-19 11:13:03 +00:00
parent 6431ee15dd
commit 47b6e11be9

View File

@@ -1356,27 +1356,19 @@
var getPaint = function(color, opac, type) {
// update the editor's fill paint
var opts = null;
var opts = { alpha: opac };
if (color.indexOf('url(#') === 0) {
var refElem = svgCanvas.getRefElem(color);
if (refElem) {
refElem = refElem.cloneNode(true);
} else {
refElem = $('#' + type + '_color defs *')[0];
refElem = $('#' + type + '_color defs *')[0];
}
opts = { alpha: opac };
opts[refElem.tagName] = refElem;
} else if (color.indexOf('#') === 0) {
opts = {
alpha: opac,
solidColor: color.substr(1)
};
opts.solidColor = color.substr(1);
} else {
opts = {
alpha: opac,
solidColor: 'none'
};
opts.solidColor = 'none';
}
return new $.jGraduate.Paint(opts);
};