Fixed opacity inheritance on ungrouping, allowed blurring on groups

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1579 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-05-28 16:05:36 +00:00
parent 6ad914980d
commit 0f6da949bf
1 changed files with 16 additions and 2 deletions

View File

@ -8187,7 +8187,7 @@ function BatchCommand(text) {
}
// only allow the transform/opacity attribute to change on <g> elements, slightly hacky
if (elem.tagName == "g" && (attr != "transform" && attr != "opacity")) continue;
if (elem.tagName == "g" && $.inArray(attr, ['transform', 'opacity', 'filter']) !== -1);
var oldval = attr == "#text" ? elem.textContent : elem.getAttribute(attr);
if (oldval == null) oldval = "";
if (oldval != String(newValue)) {
@ -8378,6 +8378,9 @@ function BatchCommand(text) {
var i = 0;
var gangle = canvas.getRotationAngle(g);
var gattrs = $(g).attr(['filter', 'opacity']);
while (g.firstChild) {
var elem = g.firstChild;
var oldNextSibling = elem.nextSibling;
@ -8385,6 +8388,12 @@ function BatchCommand(text) {
children[i++] = elem = parent.insertBefore(elem, anchor);
batchCmd.addSubCommand(new MoveElementCommand(elem, oldNextSibling, oldParent));
if(gattrs.opacity !== null && gattrs.opacity !== 1) {
var c_opac = elem.getAttribute('opacity') || 1;
var new_opac = Math.round((elem.getAttribute('opacity') || 1) * gattrs.opacity * 100)/100;
this.changeSelectedAttribute('opacity', new_opac, [elem]);
}
var chtlist = canvas.getTransformList(elem);
if (glist.numberOfItems) {
@ -8462,6 +8471,11 @@ function BatchCommand(text) {
}
}
if(gattrs.filter) {
this.changeSelectedAttribute('filter', g.getAttribute('filter'), children);
// TODO: Make the blur tool work propery on this element
}
// remove transform and make it undo-able
if (xform) {
var changes = {};