@overtone-art/canvas-editor-core 0.8.3 → 0.8.5

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
@@ -3422,7 +3422,7 @@ function composeMaskGroup(children, entries, options) {
3422
3422
  });
3423
3423
  });
3424
3424
  const first = entries.find((entry) => entry.visible);
3425
- const withBase = first && first.mode !== "add" ? [baseRect(options.box), ...children] : [...children];
3425
+ const withBase = !first || first.mode !== "add" ? [baseRect(options.box), ...children] : [...children];
3426
3426
  return new Group2(withBase, {
3427
3427
  absolutePositioned: options.absolute,
3428
3428
  // Cached, so the children's compositing operations resolve against each
@@ -3944,7 +3944,11 @@ var LayerMaskManager = class extends MaskStackStore {
3944
3944
  if (this.selected?.maskId === maskId) this.select(null, null);
3945
3945
  this.commit(target, host, entries, sources, false);
3946
3946
  const saved = entry.sourceLayer;
3947
- const restored = this.layers.add(saved?.type ?? layerTypeOf(source), source, saved?.name ?? entry.name);
3947
+ const restored = this.layers.add(
3948
+ saved?.type ?? layerTypeOf(source),
3949
+ source,
3950
+ saved?.name ?? entry.name
3951
+ );
3948
3952
  restored.meta = saved?.meta ? structuredClone(saved.meta) : {};
3949
3953
  this.layers.setVisibility(restored.id, saved?.visible ?? true);
3950
3954
  this.layers.setLocked(restored.id, saved?.locked ?? false);
@@ -4054,7 +4058,12 @@ var LayerMaskManager = class extends MaskStackStore {
4054
4058
  if (this.canvas.getActiveObject() === object) this.canvas.discardActiveObject();
4055
4059
  this.canvas.remove(object);
4056
4060
  this.layers.remove(layerId);
4057
- const entry = this.add(resolved, object, { name: layer.name, fit: false, sourceLayer, sourceObject });
4061
+ const entry = this.add(resolved, object, {
4062
+ name: layer.name,
4063
+ fit: false,
4064
+ sourceLayer,
4065
+ sourceObject
4066
+ });
4058
4067
  return entry ? { target: resolved, entry } : null;
4059
4068
  } finally {
4060
4069
  this.history.endTransaction();
@@ -4134,7 +4143,8 @@ var LayerMaskManager = class extends MaskStackStore {
4134
4143
  };
4135
4144
  function layerTypeOf(object) {
4136
4145
  if (object.type === "image") return "image";
4137
- if (object.type === "text" || object.type === "textbox" || object.type === "i-text") return "text";
4146
+ if (object.type === "text" || object.type === "textbox" || object.type === "i-text")
4147
+ return "text";
4138
4148
  return "shape";
4139
4149
  }
4140
4150
 
@@ -4243,7 +4253,7 @@ function readGradientConfig(object) {
4243
4253
  }
4244
4254
 
4245
4255
  // src/editor.ts
4246
- var MIN_ZOOM = 0.1;
4256
+ var MIN_ZOOM = 0.01;
4247
4257
  var MAX_ZOOM = 8;
4248
4258
  function isTaintedCanvasError(error) {
4249
4259
  return error instanceof DOMException && error.name === "SecurityError" || error instanceof Error && /taint|cross-origin|insecure/i.test(error.message);