From 09c409e40a23e7a5a387222f5980b8d36e24b0a8 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Wed, 28 Apr 2010 20:33:10 +0000 Subject: [PATCH] Fixed more blur-related bugs git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1552 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index eca8c9a2..31a253a4 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -7614,13 +7614,24 @@ function BatchCommand(text) { (function() { var cur_command = null; var filter = null; + var filterHidden = false; canvas.setBlurNoUndo = function(val) { if(!filter) { canvas.setBlur(val); 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() { @@ -7649,9 +7660,6 @@ function BatchCommand(text) { // Blur found! if(filter) { if(val === 0) { - var parent = filter.parentNode; - $(filter).remove(); - RemoveElementCommand(filter, parent); filter = null; } } else { @@ -7680,6 +7688,7 @@ function BatchCommand(text) { if(val === 0) { elem.removeAttribute("filter"); batchCmd.addSubCommand(new ChangeElementCommand(elem, changes)); + return; } else { this.changeSelectedAttribute("filter", 'url(#' + elem_id + '_blur)'); @@ -7702,7 +7711,7 @@ function BatchCommand(text) { } cur_command = batchCmd; - canvas.beginUndoableChange("stdDeviation", [filter.firstChild]); + canvas.beginUndoableChange("stdDeviation", [filter?filter.firstChild:null]); if(complete) { canvas.setBlurNoUndo(val); finishChange();