Fixed more blur-related bugs

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1552 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-04-28 20:33:10 +00:00
parent 543c6661a9
commit 09c409e40a
1 changed files with 14 additions and 5 deletions

View File

@ -7614,13 +7614,24 @@ function BatchCommand(text) {
(function() { (function() {
var cur_command = null; var cur_command = null;
var filter = null; var filter = null;
var filterHidden = false;
canvas.setBlurNoUndo = function(val) { canvas.setBlurNoUndo = function(val) {
if(!filter) { if(!filter) {
canvas.setBlur(val); canvas.setBlur(val);
return; return;
} }
canvas.changeSelectedAttributeNoUndo("stdDeviation", val, [filter.firstChild]); if(val === 0) {
// Don't change the StdDev, as that will hide the element.
// Instead, just remove the value for "filter"
canvas.changeSelectedAttributeNoUndo("filter", "");
filterHidden = true;
} else {
if(filterHidden) {
canvas.changeSelectedAttributeNoUndo("filter", 'url(#' + selectedElements[0].id + '_blur)');
}
canvas.changeSelectedAttributeNoUndo("stdDeviation", val, [filter.firstChild]);
}
} }
function finishChange() { function finishChange() {
@ -7649,9 +7660,6 @@ function BatchCommand(text) {
// Blur found! // Blur found!
if(filter) { if(filter) {
if(val === 0) { if(val === 0) {
var parent = filter.parentNode;
$(filter).remove();
RemoveElementCommand(filter, parent);
filter = null; filter = null;
} }
} else { } else {
@ -7680,6 +7688,7 @@ function BatchCommand(text) {
if(val === 0) { if(val === 0) {
elem.removeAttribute("filter"); elem.removeAttribute("filter");
batchCmd.addSubCommand(new ChangeElementCommand(elem, changes)); batchCmd.addSubCommand(new ChangeElementCommand(elem, changes));
return;
} else { } else {
this.changeSelectedAttribute("filter", 'url(#' + elem_id + '_blur)'); this.changeSelectedAttribute("filter", 'url(#' + elem_id + '_blur)');
@ -7702,7 +7711,7 @@ function BatchCommand(text) {
} }
cur_command = batchCmd; cur_command = batchCmd;
canvas.beginUndoableChange("stdDeviation", [filter.firstChild]); canvas.beginUndoableChange("stdDeviation", [filter?filter.firstChild:null]);
if(complete) { if(complete) {
canvas.setBlurNoUndo(val); canvas.setBlurNoUndo(val);
finishChange(); finishChange();