canvas-editor-engine 2.3.56 → 2.3.58

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 +14 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2611,14 +2611,21 @@ var DrawLayersService = function() {
2611
2611
  status: "error",
2612
2612
  message: "Replaceable layer not found"
2613
2613
  });
2614
- layer.order = newOrder;
2615
- _this.layerList[layerIndex] = layer;
2616
- _this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", layer);
2617
- console.log(_this.layerList.slice(layerIndex + 1, replaceableIndex + 1));
2618
- _this.layerList.slice(layerIndex + 1, replaceableIndex + 1).forEach((function(layer, index) {
2619
- _this.layerList[index].order = layer.order - 1;
2620
- _this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", _this.layerList[index]);
2614
+ _this.layerList.sort((function(a, b) {
2615
+ return a.order - b.order;
2616
+ }));
2617
+ var layerIdx = _this.layerList.findIndex((function(layer) {
2618
+ return layer.id === id;
2621
2619
  }));
2620
+ var replaceableIdx = _this.layerList.findIndex((function(layer) {
2621
+ return layer.order === newOrder;
2622
+ }));
2623
+ _this.layerList.slice(layerIdx + 1, replaceableIdx + 1).forEach((function(rlayer, idx) {
2624
+ _this.layerList[idx].order = rlayer.order - 1;
2625
+ _this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", _this.layerList[idx]);
2626
+ }));
2627
+ _this.layerList[layerIdx].order = newOrder;
2628
+ _this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", layer);
2622
2629
  } else {
2623
2630
  layer.order = newOrder;
2624
2631
  _this.layerList[layerIndex] = layer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.3.56",
3
+ "version": "2.3.58",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",