kangax/fabric.js — Issue #108: SVG LinearGradients (Vertical)
Author: aarr0n
Created: 2012-01-19 21:04:20+00:00
State: open

Version 7.11

In function fromElement line 3663:

The **coords** object uses the el variable to get the x1, y1, x2, y2 values of each linearGradient. However, before these values are set, the **el** variable is redefined to each colorStop element found within the linearGradient

Because of this x1, y1, x2, y2 will always be set to their fallback/default val - 0,0,100%,0 respectively.

If we move :

var coords = {
x1: el.getAttribute('x1') || 0,
y1: el.getAttribute('y1') || 0,
x2: el.getAttribute('x2') || '100%',
y2: el.getAttribute('y2') || 0
};

...to be above

var colorStopEls = el.getElementsByTagName('stop'),
// ..etc

...the vertical linearGradients are correctly presented.