@overtone-art/canvas-editor-core 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +3 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4783,6 +4783,7 @@ var DEFAULT_GRADIENT_CONFIG = {
|
|
|
4783
4783
|
]
|
|
4784
4784
|
};
|
|
4785
4785
|
var MIN_RADIUS = 1e-3;
|
|
4786
|
+
var MAX_GRADIENT_STOPS = 256;
|
|
4786
4787
|
var FALLBACK_STOP_COLOR = DEFAULT_GRADIENT_CONFIG.stops[0].color;
|
|
4787
4788
|
function linearCoords(angle, box) {
|
|
4788
4789
|
const radians = angle * Math.PI / 180;
|
|
@@ -4813,7 +4814,7 @@ function stopColor(stop) {
|
|
|
4813
4814
|
return color.toRgba();
|
|
4814
4815
|
}
|
|
4815
4816
|
function toFabricGradient(config, box) {
|
|
4816
|
-
const colorStops = [...config.stops].sort((a, b) => a.position - b.position).map((stop) => {
|
|
4817
|
+
const colorStops = [...config.stops].sort((a, b) => a.position - b.position).slice(0, MAX_GRADIENT_STOPS).map((stop) => {
|
|
4817
4818
|
const position = Number.isFinite(stop.position) ? stop.position : 0;
|
|
4818
4819
|
return { offset: clamp(position, 0, 1), color: stopColor(stop) };
|
|
4819
4820
|
});
|