File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -490,7 +490,21 @@ class SVGData extends Group {
490490
491491 grad .colors .push (getColorStyle (" stop-color" , stop , styles , 0x000000 ));
492492 grad .alphas .push (getFloatStyle (" stop-opacity" , stop , styles , 1.0 ));
493- grad .ratios .push (Std .int (Std .parseFloat (stop .get (" offset" )) * 255.0 ));
493+ var percent = 0.0 ;
494+ if (stop .exists (" offset" )) {
495+ var offset = stop .get (" offset" );
496+ if (offset .indexOf (" %" ) != - 1 ) {
497+ // 0% - 100%
498+ percent = Std .parseFloat (offset ) / 100.0 ;
499+ } else {
500+ // 0.0 - 1.0
501+ percent = Std .parseFloat (offset );
502+ }
503+ if (Math .isNaN (percent )) {
504+ throw (" Unknown stop offset:" + offset );
505+ }
506+ }
507+ grad .ratios .push (Std .int (percent * 255.0 ));
494508
495509 }
496510
You can’t perform that action at this time.
0 commit comments