canvas-editor-engine 2.3.54 → 2.3.56
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 +26 -19
- package/dist/services/draw-layers.service.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2542,7 +2542,7 @@ var DrawLayersService = function() {
|
|
2542
2542
|
});
|
2543
2543
|
}));
|
2544
2544
|
};
|
2545
|
-
DrawLayersService.prototype.changeLayerOrder = function(id, options) {
|
2545
|
+
DrawLayersService.prototype.changeLayerOrder = function(id, options, noReplayseable) {
|
2546
2546
|
return __awaiter(this, void 0, void 0, (function() {
|
2547
2547
|
var _this = this;
|
2548
2548
|
return __generator(this, (function(_a) {
|
@@ -2599,24 +2599,31 @@ var DrawLayersService = function() {
|
|
2599
2599
|
newOrder = layer.order / operand;
|
2600
2600
|
}
|
2601
2601
|
}
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2602
|
+
if (!noReplayseable) {
|
2603
|
+
var replaceableIndex = _this.layerList.findIndex((function(layer) {
|
2604
|
+
return layer.order === newOrder;
|
2605
|
+
}));
|
2606
|
+
if (replaceableIndex === layerIndex) return reject({
|
2607
|
+
status: "error",
|
2608
|
+
message: "Layer order equals to replaceable layer order"
|
2609
|
+
});
|
2610
|
+
if (replaceableIndex === -1) return reject({
|
2611
|
+
status: "error",
|
2612
|
+
message: "Replaceable layer not found"
|
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]);
|
2621
|
+
}));
|
2622
|
+
} else {
|
2623
|
+
layer.order = newOrder;
|
2624
|
+
_this.layerList[layerIndex] = layer;
|
2625
|
+
_this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", layer);
|
2626
|
+
}
|
2620
2627
|
resolve({
|
2621
2628
|
status: "success",
|
2622
2629
|
message: "Layer order updated"
|
@@ -26,7 +26,8 @@ export default class DrawLayersService {
|
|
26
26
|
* 3. addendum (optional)
|
27
27
|
* @param id ILayer['id']
|
28
28
|
* @param options IUpdateLayerOptions
|
29
|
+
* @param noReplayseable (optional) If true, the operation will not use the layer being replaceable ([0, 1, 2, 3] -> [0, 2*, 2, 3] -> [0, 1, 2*, 3])
|
29
30
|
* @returns promise { status: 'success' | 'error', message: string }
|
30
31
|
*/
|
31
|
-
changeLayerOrder(id: ILayer['id'], options: IUpdateLayerOptions): Promise<unknown>;
|
32
|
+
changeLayerOrder(id: ILayer['id'], options: IUpdateLayerOptions, noReplayseable?: boolean): Promise<unknown>;
|
32
33
|
}
|