canvas-editor-engine 2.2.2 → 2.2.4
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 +15 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -1416,8 +1416,13 @@ var Reducer$1 = function() {
|
|
1416
1416
|
Reducer.prototype.updateLayer = function(payload) {
|
1417
1417
|
var isUpdate = false;
|
1418
1418
|
if (!!payload) {
|
1419
|
-
this.state._layers.
|
1420
|
-
|
1419
|
+
var targetLayerIndex = this.state._layers.findIndex((function(layer) {
|
1420
|
+
return layer.id === payload.id;
|
1421
|
+
}));
|
1422
|
+
if (targetLayerIndex != -1) {
|
1423
|
+
this.state._layers[targetLayerIndex] = payload;
|
1424
|
+
isUpdate = true;
|
1425
|
+
}
|
1421
1426
|
}
|
1422
1427
|
if (isUpdate && !!this.state._emergeCompleteIt) {
|
1423
1428
|
this.state._emergeCompleteIt(this.state._layers);
|
@@ -2528,7 +2533,14 @@ var DrawLayersService = function() {
|
|
2528
2533
|
var _a;
|
2529
2534
|
var layerName = layerOptions.layerName, painter = layerOptions.painter;
|
2530
2535
|
var id = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
2531
|
-
var name =
|
2536
|
+
var name = function() {
|
2537
|
+
if (layerName) return layerName;
|
2538
|
+
if (painter) {
|
2539
|
+
return "".concat(painter.drawType, "-").concat(painter.id);
|
2540
|
+
} else {
|
2541
|
+
return "New Layer";
|
2542
|
+
}
|
2543
|
+
}();
|
2532
2544
|
var painters = painter ? [ painter ] : [];
|
2533
2545
|
var sortedLayers = (_a = this.layerList) === null || _a === void 0 ? void 0 : _a.sort((function(a, b) {
|
2534
2546
|
return a.order - b.order;
|