Fixed Issue 137: Can't change gradient of a text element
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@489 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
60020d9cc2
commit
74c398b151
|
@ -2273,11 +2273,10 @@ function SvgCanvas(c)
|
||||||
// find out if there is a duplicate gradient already in the defs
|
// find out if there is a duplicate gradient already in the defs
|
||||||
var duplicate_grad = findDuplicateGradient(grad);
|
var duplicate_grad = findDuplicateGradient(grad);
|
||||||
var defs = findDefs();
|
var defs = findDefs();
|
||||||
|
|
||||||
// no duplicate found, so import gradient into defs
|
// no duplicate found, so import gradient into defs
|
||||||
if (!duplicate_grad) {
|
if (!duplicate_grad) {
|
||||||
grad = defs.appendChild( svgdoc.importNode(grad, true) );
|
grad = defs.appendChild( svgdoc.importNode(grad, true) );
|
||||||
|
|
||||||
// get next id and set it on the grad
|
// get next id and set it on the grad
|
||||||
grad.id = getNextId();
|
grad.id = getNextId();
|
||||||
}
|
}
|
||||||
|
@ -2568,6 +2567,17 @@ function SvgCanvas(c)
|
||||||
if (attr == "#text") elem.textContent = val;
|
if (attr == "#text") elem.textContent = val;
|
||||||
else elem.setAttribute(attr, val);
|
else elem.setAttribute(attr, val);
|
||||||
selectedBBoxes[i] = this.getBBox(elem);
|
selectedBBoxes[i] = this.getBBox(elem);
|
||||||
|
if(elem.nodeName == 'text' && (val+'').indexOf('url') == 0) {
|
||||||
|
// Hack for Firefox new-gradient-on-text-bug
|
||||||
|
// Seems like the only way a new gradient is accepted is by creating a new elem
|
||||||
|
elem.setAttribute(attr, val);
|
||||||
|
var clone = elem.cloneNode(true)
|
||||||
|
elem.parentNode.insertBefore(clone, elem);
|
||||||
|
elem.parentNode.removeChild(elem);
|
||||||
|
elem = clone;
|
||||||
|
canvas.clearSelection();
|
||||||
|
canvas.addToSelection([elem],true);
|
||||||
|
}
|
||||||
// Timeout needed for Opera & Firefox
|
// Timeout needed for Opera & Firefox
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
selectorManager.requestSelector(elem).resize(selectedBBoxes[i]);
|
selectorManager.requestSelector(elem).resize(selectedBBoxes[i]);
|
||||||
|
|
Loading…
Reference in New Issue