diff --git a/src/item/PlacedSymbol.js b/src/item/PlacedSymbol.js index f8a5de60..64962f0a 100644 --- a/src/item/PlacedSymbol.js +++ b/src/item/PlacedSymbol.js @@ -32,6 +32,14 @@ PlacedSymbol = Item.extend({ bounds.y = coords[1]; bounds.width = coords[2] - coords[0]; bounds.height = coords[3] - coords[1]; + if (bounds.width < 0) { + bounds.x = coords[2]; + bounds.width = -bounds.width; + } + if (bounds.height < 0) { + bounds.y = coords[3]; + bounds.height = bounds.height; + } }, getBounds: function() { @@ -39,14 +47,14 @@ PlacedSymbol = Item.extend({ }, draw: function(ctx, param) { - // TODO: BlendMode isn't working yet for PlacedSymbols. if(this.blendMode != 'normal' && !param.ignoreBlendMode) { BlendMode.process(ctx, this, param); } else { - param.ignoreBlendMode = false; // TODO: we need to preserve strokewidth, but still transform the fill ctx.save(); - this.matrix.applyToContext(ctx); + if(param.ignoreBlendMode !== true) + this.matrix.applyToContext(ctx); + param.ignoreBlendMode = false; this.symbol.definition.draw(ctx, param); ctx.restore(); } diff --git a/src/item/Raster.js b/src/item/Raster.js index ce75016b..57decad6 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -159,6 +159,14 @@ Raster = Item.extend({ bounds.y = coords[1]; bounds.width = coords[2] - coords[0]; bounds.height = coords[3] - coords[1]; + if (bounds.width < 0) { + bounds.x = coords[2]; + bounds.width = -bounds.width; + } + if (bounds.height < 0) { + bounds.y = coords[3]; + bounds.height = bounds.height; + } }, getBounds: function() { @@ -169,12 +177,13 @@ Raster = Item.extend({ if(this.blendMode != 'normal' && !param.ignoreBlendMode) { BlendMode.process(ctx, this, param); } else { - param.ignoreBlendMode = false; ctx.save(); - this.matrix.applyToContext(ctx); + if(param.ignoreBlendMode !== true) + this.matrix.applyToContext(ctx); ctx.drawImage(this._canvas || this._image, -this.size.width / 2, -this.size.height / 2); ctx.restore(); + param.ignoreBlendMode = false; } } }, new function() {