@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.js CHANGED
@@ -2716,8 +2716,10 @@ var TextWrapManager = class {
2716
2716
  text.dirty = true;
2717
2717
  text.setCoords();
2718
2718
  this.canvas.requestRenderAll();
2719
- this.events.emit("layer:modified", { layerId });
2720
- if (save) this.history.save();
2719
+ if (save) {
2720
+ this.events.emit("layer:modified", { layerId });
2721
+ this.history.save();
2722
+ }
2721
2723
  return true;
2722
2724
  }
2723
2725
  };
@@ -4783,6 +4785,7 @@ var DEFAULT_GRADIENT_CONFIG = {
4783
4785
  ]
4784
4786
  };
4785
4787
  var MIN_RADIUS = 1e-3;
4788
+ var MAX_GRADIENT_STOPS = 256;
4786
4789
  var FALLBACK_STOP_COLOR = DEFAULT_GRADIENT_CONFIG.stops[0].color;
4787
4790
  function linearCoords(angle, box) {
4788
4791
  const radians = angle * Math.PI / 180;
@@ -4813,7 +4816,7 @@ function stopColor(stop) {
4813
4816
  return color.toRgba();
4814
4817
  }
4815
4818
  function toFabricGradient(config, box) {
4816
- const colorStops = [...config.stops].sort((a, b) => a.position - b.position).map((stop) => {
4819
+ const colorStops = [...config.stops].sort((a, b) => a.position - b.position).slice(0, MAX_GRADIENT_STOPS).map((stop) => {
4817
4820
  const position = Number.isFinite(stop.position) ? stop.position : 0;
4818
4821
  return { offset: clamp(position, 0, 1), color: stopColor(stop) };
4819
4822
  });