Skip to content
Browse files

Fix #36

A bug in svg-renderer where filters couldn't be removed.
  • Loading branch information...
1 parent 5300234 commit c1c3e23dbb360583193b568778944facc6cfaef6 @basecode basecode committed Aug 24, 2012
Showing with 11 additions and 7 deletions.
  1. +1 −0 CHANGELOG
  2. +10 −7 src/renderer/svg/svg.js
View
1 CHANGELOG
@@ -7,6 +7,7 @@ v0.3.4
* Fix #33 where `null` should be passed instead of `undefined`
as second parameter to `parent.insertBefore` (thx @jdalton)
* Add `diffX` and `diffY` properties to `pointerup` event object.
+* Fix #36 where filters couldn't be removed (thx @qfox)
v0.3.3
-------------------
View
17 src/renderer/svg/svg.js
@@ -69,6 +69,9 @@ define([
'mousewheel'
];
+ // tools
+ var isArray = tools.isArray;
+
var xlink = 'http://www.w3.org/1999/xlink';
function createElement(n, id) {
@@ -407,24 +410,24 @@ define([
*/
proto.drawAll = function(type, element, message) {
- var hasFilters = false;
var attr = message.attributes;
+ var filters = attr.filters;
var fillColor = attr.fillColor;
var fillGradient = attr.fillGradient;
- var filters = attr.filters || [];
var svg = this.svg;
// when filter is applied, force fillColor change on UA w/o SVG Filter support
if (!isFEColorMatrixEnabled && !fillColor && filters && element._fillColorSignature) {
fillColor = element._fillColorSignature;
}
- if (filters.length) {
- hasFilters = true;
- this.applyFilters(element, filters);
- } else if (filters === null) {
- element._filterSignature &&
+ if (isArray(filters)) {
+ // modify filters
+ if (filters.length > 0) {
+ this.applyFilters(element, filters);
+ } else {
this.removeFilters(element);
+ }
}
if (message.offStageType === 'clip') {

0 comments on commit c1c3e23

Please sign in to comment.
Something went wrong with that request. Please try again.