From 36dc5f3cd305535a231e9ba2fe5f7a6e5bf1e4d3 Mon Sep 17 00:00:00 2001 From: Zeno Zeng Date: Wed, 10 Jun 2015 15:19:57 +0800 Subject: [PATCH] set paint order before stroke and fill to make them behavior like canvas --- canvas2svg.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/canvas2svg.js b/canvas2svg.js index 47b1834..ed6975c 100644 --- a/canvas2svg.js +++ b/canvas2svg.js @@ -580,6 +580,9 @@ * Sets the stroke property on the current element */ ctx.prototype.stroke = function(){ + if(this.__currentElement.nodeName === "path") { + this.__currentElement.setAttribute("paint-order", "fill stroke markers"); + } this.__applyCurrentDefaultPath(); this.__applyStyleToCurrentElement("stroke"); }; @@ -588,6 +591,9 @@ * Sets fill properties on the current element */ ctx.prototype.fill = function(){ + if(this.__currentElement.nodeName === "path") { + this.__currentElement.setAttribute("paint-order", "stroke fill markers"); + } this.__applyCurrentDefaultPath(); this.__applyStyleToCurrentElement("fill"); };