canvas-editor-engine 2.2.3 → 2.2.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
@@ -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);
@@ -2555,6 +2560,11 @@ var DrawLayersService = function() {
2555
2560
  return layer.order === order;
2556
2561
  }));
2557
2562
  };
2563
+ DrawLayersService.prototype.getLayerById = function(layerId) {
2564
+ return this.layerList.find((function(layer) {
2565
+ return layer.id === layerId;
2566
+ }));
2567
+ };
2558
2568
  DrawLayersService.prototype.addToLayer = function(id, painter) {
2559
2569
  var layerIndex = this.layerList.findIndex((function(layer) {
2560
2570
  return layer.id === id;
@@ -10,6 +10,7 @@ export default class DrawLayersService {
10
10
  painter?: IPainter;
11
11
  }): void;
12
12
  getLayerByOrder(order: number): ILayer;
13
+ getLayerById(layerId: ILayer['id']): ILayer;
13
14
  addToLayer(id: ILayer['id'], painter: IPainter): void;
14
15
  updateLayer(id: ILayer['id'], updateData?: ILayerUpdate): void;
15
16
  }
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.5",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",