mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: enforce colorstop min 0 (#1743)
This commit is contained in:
parent
c45ef099fe
commit
349bbf137a
@ -26,7 +26,10 @@ const addColorStops = (
|
|||||||
const maxStop = Math.max.apply(null, gradient.colorStops.map(colorStop => colorStop.stop));
|
const maxStop = Math.max.apply(null, gradient.colorStops.map(colorStop => colorStop.stop));
|
||||||
const f = 1 / Math.max(1, maxStop);
|
const f = 1 / Math.max(1, maxStop);
|
||||||
gradient.colorStops.forEach(colorStop => {
|
gradient.colorStops.forEach(colorStop => {
|
||||||
canvasGradient.addColorStop(f * colorStop.stop, colorStop.color.toString());
|
canvasGradient.addColorStop(
|
||||||
|
Math.floor(Math.max(0, f * colorStop.stop)),
|
||||||
|
colorStop.color.toString()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user