From 368f6e64175c22e0da9fb2177f223c8d7428509f Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Wed, 13 Oct 2010 14:05:20 +0000 Subject: [PATCH] Fixed Issue 718: Gradient missing when opening, but fine when imported git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1797 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index fa951e96..ded2b40d 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -8306,6 +8306,20 @@ var convertGradients = this.convertGradients = function(elem) { if(grad.tagName === 'linearGradient') { var g_coords = $(grad).attr(['x1', 'y1', 'x2', 'y2']); + // If has transform, convert + var tlist = grad.gradientTransform.baseVal; + if(tlist && tlist.numberOfItems > 0) { + var m = transformListToTransform(tlist).matrix; + var pt1 = transformPoint(g_coords.x1, g_coords.y1, m); + var pt2 = transformPoint(g_coords.x2, g_coords.y2, m); + + g_coords.x1 = pt1.x; + g_coords.y1 = pt1.y; + g_coords.x2 = pt2.x; + g_coords.y2 = pt2.y; + grad.removeAttribute('gradientTransform'); + } + $(grad).attr({ x1: (g_coords.x1 - bb.x) / bb.width, y1: (g_coords.y1 - bb.y) / bb.height,