@overtone-art/canvas-editor-core 0.8.0 → 0.8.2

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.mjs CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  toHostSpace,
27
27
  toMatrix,
28
28
  unwrapGroup
29
- } from "./chunk-XNGPX7FG.mjs";
29
+ } from "./chunk-TP527WVQ.mjs";
30
30
 
31
31
  // src/editor.ts
32
32
  import { Canvas, FabricImage as FabricImage3, Group as Group7, Rect as Rect4, Textbox as Textbox2, filters } from "fabric";
@@ -4086,6 +4086,7 @@ var DEFAULT_GRADIENT_CONFIG = {
4086
4086
  ]
4087
4087
  };
4088
4088
  var MIN_RADIUS = 1e-3;
4089
+ var MAX_GRADIENT_STOPS = 256;
4089
4090
  var FALLBACK_STOP_COLOR = DEFAULT_GRADIENT_CONFIG.stops[0].color;
4090
4091
  function linearCoords(angle, box) {
4091
4092
  const radians = angle * Math.PI / 180;
@@ -4116,7 +4117,7 @@ function stopColor(stop) {
4116
4117
  return color.toRgba();
4117
4118
  }
4118
4119
  function toFabricGradient(config, box) {
4119
- const colorStops = [...config.stops].sort((a, b) => a.position - b.position).map((stop) => {
4120
+ const colorStops = [...config.stops].sort((a, b) => a.position - b.position).slice(0, MAX_GRADIENT_STOPS).map((stop) => {
4120
4121
  const position = Number.isFinite(stop.position) ? stop.position : 0;
4121
4122
  return { offset: clamp(position, 0, 1), color: stopColor(stop) };
4122
4123
  });