canvas-editor-engine 2.2.3 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -2
  2. 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.push(payload);
1420
- isUpdate = true;
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",