canvas-editor-engine 2.3.53 → 2.3.55
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 +35 -27
- 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) {
|
@@ -2570,17 +2570,19 @@ var DrawLayersService = function() {
|
|
2570
2570
|
break;
|
2571
2571
|
|
2572
2572
|
case "front":
|
2573
|
-
var
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2573
|
+
var mostMax_1 = 0;
|
2574
|
+
_this.layerList.forEach((function(l) {
|
2575
|
+
return l.order > mostMax_1 ? mostMax_1 = l.order : null;
|
2576
|
+
}));
|
2577
|
+
newOrder = mostMax_1;
|
2577
2578
|
break;
|
2578
2579
|
|
2579
2580
|
case "back":
|
2580
|
-
var
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2581
|
+
var mostMin_1 = Infinity;
|
2582
|
+
_this.layerList.forEach((function(l) {
|
2583
|
+
return l.order < mostMin_1 ? mostMin_1 = l.order : null;
|
2584
|
+
}));
|
2585
|
+
newOrder = mostMin_1;
|
2584
2586
|
break;
|
2585
2587
|
}
|
2586
2588
|
}
|
@@ -2597,24 +2599,30 @@ var DrawLayersService = function() {
|
|
2597
2599
|
newOrder = layer.order / operand;
|
2598
2600
|
}
|
2599
2601
|
}
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
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
|
+
_this.layerList.slice(layerIndex + 1, replaceableIndex + 1).forEach((function(layer, index) {
|
2618
|
+
_this.layerList[index].order = layer.order - 1;
|
2619
|
+
_this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", _this.layerList[index]);
|
2620
|
+
}));
|
2621
|
+
} else {
|
2622
|
+
layer.order = newOrder;
|
2623
|
+
_this.layerList[layerIndex] = layer;
|
2624
|
+
_this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", layer);
|
2625
|
+
}
|
2618
2626
|
resolve({
|
2619
2627
|
status: "success",
|
2620
2628
|
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
|
}
|