@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.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4122,7 +4122,7 @@ function composeMaskGroup(children, entries, options) {
|
|
|
4122
4122
|
});
|
|
4123
4123
|
});
|
|
4124
4124
|
const first = entries.find((entry) => entry.visible);
|
|
4125
|
-
const withBase = first
|
|
4125
|
+
const withBase = !first || first.mode !== "add" ? [baseRect(options.box), ...children] : [...children];
|
|
4126
4126
|
return new import_fabric15.Group(withBase, {
|
|
4127
4127
|
absolutePositioned: options.absolute,
|
|
4128
4128
|
// Cached, so the children's compositing operations resolve against each
|
|
@@ -4644,7 +4644,11 @@ var LayerMaskManager = class extends MaskStackStore {
|
|
|
4644
4644
|
if (this.selected?.maskId === maskId) this.select(null, null);
|
|
4645
4645
|
this.commit(target, host, entries, sources, false);
|
|
4646
4646
|
const saved = entry.sourceLayer;
|
|
4647
|
-
const restored = this.layers.add(
|
|
4647
|
+
const restored = this.layers.add(
|
|
4648
|
+
saved?.type ?? layerTypeOf(source),
|
|
4649
|
+
source,
|
|
4650
|
+
saved?.name ?? entry.name
|
|
4651
|
+
);
|
|
4648
4652
|
restored.meta = saved?.meta ? structuredClone(saved.meta) : {};
|
|
4649
4653
|
this.layers.setVisibility(restored.id, saved?.visible ?? true);
|
|
4650
4654
|
this.layers.setLocked(restored.id, saved?.locked ?? false);
|
|
@@ -4754,7 +4758,12 @@ var LayerMaskManager = class extends MaskStackStore {
|
|
|
4754
4758
|
if (this.canvas.getActiveObject() === object) this.canvas.discardActiveObject();
|
|
4755
4759
|
this.canvas.remove(object);
|
|
4756
4760
|
this.layers.remove(layerId);
|
|
4757
|
-
const entry = this.add(resolved, object, {
|
|
4761
|
+
const entry = this.add(resolved, object, {
|
|
4762
|
+
name: layer.name,
|
|
4763
|
+
fit: false,
|
|
4764
|
+
sourceLayer,
|
|
4765
|
+
sourceObject
|
|
4766
|
+
});
|
|
4758
4767
|
return entry ? { target: resolved, entry } : null;
|
|
4759
4768
|
} finally {
|
|
4760
4769
|
this.history.endTransaction();
|
|
@@ -4834,7 +4843,8 @@ var LayerMaskManager = class extends MaskStackStore {
|
|
|
4834
4843
|
};
|
|
4835
4844
|
function layerTypeOf(object) {
|
|
4836
4845
|
if (object.type === "image") return "image";
|
|
4837
|
-
if (object.type === "text" || object.type === "textbox" || object.type === "i-text")
|
|
4846
|
+
if (object.type === "text" || object.type === "textbox" || object.type === "i-text")
|
|
4847
|
+
return "text";
|
|
4838
4848
|
return "shape";
|
|
4839
4849
|
}
|
|
4840
4850
|
|
|
@@ -4943,7 +4953,7 @@ function readGradientConfig(object) {
|
|
|
4943
4953
|
}
|
|
4944
4954
|
|
|
4945
4955
|
// src/editor.ts
|
|
4946
|
-
var MIN_ZOOM = 0.
|
|
4956
|
+
var MIN_ZOOM = 0.01;
|
|
4947
4957
|
var MAX_ZOOM = 8;
|
|
4948
4958
|
function isTaintedCanvasError(error) {
|
|
4949
4959
|
return error instanceof DOMException && error.name === "SecurityError" || error instanceof Error && /taint|cross-origin|insecure/i.test(error.message);
|