canvas-editor-engine 2.3.45 → 2.3.46
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
@@ -2457,6 +2457,13 @@ var DrawLayersService = function() {
|
|
2457
2457
|
return layer.id === layerId;
|
2458
2458
|
}));
|
2459
2459
|
};
|
2460
|
+
DrawLayersService.prototype.getLayerByPainterId = function(painterId) {
|
2461
|
+
return this.layerList.find((function(layer) {
|
2462
|
+
return layer.painters.find((function(painter) {
|
2463
|
+
return painter.id === painterId;
|
2464
|
+
}));
|
2465
|
+
}));
|
2466
|
+
};
|
2460
2467
|
DrawLayersService.prototype.addToLayer = function(id, painter) {
|
2461
2468
|
var layerIndex = this.layerList.findIndex((function(layer) {
|
2462
2469
|
return layer.id === id;
|
@@ -2595,17 +2602,37 @@ var Painter = function() {
|
|
2595
2602
|
this.drawType = createModel.drawType;
|
2596
2603
|
this.id = createModel.id;
|
2597
2604
|
this.name = createModel.name;
|
2605
|
+
this.order = (createModel === null || createModel === void 0 ? void 0 : createModel.order) || null;
|
2606
|
+
this.createdAt = {
|
2607
|
+
view: new Date,
|
2608
|
+
digital: Date.now()
|
2609
|
+
};
|
2598
2610
|
}
|
2599
2611
|
Painter.prototype.putPainter = function(painter) {
|
2600
|
-
|
2601
|
-
|
2602
|
-
this
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2612
|
+
return __awaiter(this, void 0, void 0, (function() {
|
2613
|
+
var _this = this;
|
2614
|
+
return __generator(this, (function(_a) {
|
2615
|
+
return [ 2, new Promise((function(resolve, reject) {
|
2616
|
+
var isUpdated = false;
|
2617
|
+
if (painter === null || painter === void 0 ? void 0 : painter.name) {
|
2618
|
+
_this.name = painter.name;
|
2619
|
+
isUpdated = true;
|
2620
|
+
}
|
2621
|
+
if (painter === null || painter === void 0 ? void 0 : painter.order) {
|
2622
|
+
_this.order = painter.order;
|
2623
|
+
isUpdated = true;
|
2624
|
+
}
|
2625
|
+
if (isUpdated) {
|
2626
|
+
_this.drawLayersService.updatePainterData(_this);
|
2627
|
+
resolve(true);
|
2628
|
+
return true;
|
2629
|
+
} else {
|
2630
|
+
reject(false);
|
2631
|
+
return false;
|
2632
|
+
}
|
2633
|
+
})) ];
|
2634
|
+
}));
|
2635
|
+
}));
|
2609
2636
|
};
|
2610
2637
|
return Painter;
|
2611
2638
|
}();
|
@@ -2674,7 +2701,6 @@ var DrawAccumulatorService = function() {
|
|
2674
2701
|
object: painter,
|
2675
2702
|
update: this.update.bind(this)
|
2676
2703
|
});
|
2677
|
-
console.log(this.painters);
|
2678
2704
|
this.drawLayersService.addToLayer(layerId, painter);
|
2679
2705
|
this.invokePainter(drawType, painter.drawService);
|
2680
2706
|
return [ 2 ];
|
@@ -2723,17 +2749,29 @@ var DrawAccumulatorService = function() {
|
|
2723
2749
|
}));
|
2724
2750
|
}));
|
2725
2751
|
};
|
2752
|
+
DrawAccumulatorService.prototype.changePainterOrder = function(painterId, order) {
|
2753
|
+
var _this = this;
|
2754
|
+
var painter = this.painters.find((function(painter) {
|
2755
|
+
return painter.id === painterId;
|
2756
|
+
}));
|
2757
|
+
if (!painter) return console.error("Painter not found");
|
2758
|
+
painter.putPainter({
|
2759
|
+
order
|
2760
|
+
}).then((function() {
|
2761
|
+
_this.update();
|
2762
|
+
}));
|
2763
|
+
};
|
2726
2764
|
DrawAccumulatorService.prototype.renamePainter = function(painterId, name) {
|
2765
|
+
var _this = this;
|
2727
2766
|
var painter = this.painters.find((function(painter) {
|
2728
2767
|
return painter.id === painterId;
|
2729
2768
|
}));
|
2730
|
-
if (painter)
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
}
|
2769
|
+
if (!painter) return console.error("Painter not found");
|
2770
|
+
painter.putPainter({
|
2771
|
+
name
|
2772
|
+
}).then((function() {
|
2773
|
+
_this.update();
|
2774
|
+
}));
|
2737
2775
|
};
|
2738
2776
|
DrawAccumulatorService.prototype.smoothFilter = function(painterId, smoothFilterOptions) {
|
2739
2777
|
return __awaiter(this, void 0, void 0, (function() {
|
@@ -2796,7 +2834,7 @@ var DrawAccumulatorService = function() {
|
|
2796
2834
|
}));
|
2797
2835
|
}));
|
2798
2836
|
};
|
2799
|
-
DrawAccumulatorService.prototype.
|
2837
|
+
DrawAccumulatorService.prototype.changeLayerOrder = function(layerId, options) {
|
2800
2838
|
var _this = this;
|
2801
2839
|
this.drawLayersService.changeLayerOrder(layerId, options).then((function(res) {
|
2802
2840
|
if (res.status === "success") {
|
@@ -17,11 +17,12 @@ export default class DrawAccumulatorService {
|
|
17
17
|
add<DrawType extends TDrawType>(layerId: ILayer['id'], drawType: DrawType, options: DrawService['options'][DrawType], initialSize: ITempCanvasOptions): Promise<void>;
|
18
18
|
getPainterById(painterId: string): Painter;
|
19
19
|
removePainter(painterId: string): Promise<void>;
|
20
|
-
|
20
|
+
changePainterOrder(painterId: Painter['id'], order: Painter['order']): void;
|
21
|
+
renamePainter(painterId: IPainter['id'], name: IPainter['name']): void;
|
21
22
|
smoothFilter(painterId: IPainter['id'], smoothFilterOptions: ISmoothFilterOptions): Promise<void>;
|
22
23
|
renameLayer(id: ILayer["id"], newName: ILayerUpdate['name']): Promise<void>;
|
23
24
|
removeLayer(layerId: ILayer['id']): Promise<void>;
|
24
|
-
|
25
|
+
changeLayerOrder(layerId: ILayer['id'], options: IUpdateLayerOptions): void;
|
25
26
|
private update;
|
26
27
|
private get gradient();
|
27
28
|
private clearCanvas;
|
@@ -13,6 +13,7 @@ export default class DrawLayersService {
|
|
13
13
|
getLayerByOrder(order: number): ILayer;
|
14
14
|
getLayersByOrder(order: number): ILayer[];
|
15
15
|
getLayerById(layerId: ILayer['id']): ILayer;
|
16
|
+
getLayerByPainterId(painterId: IPainter['id']): ILayer;
|
16
17
|
addToLayer(id: ILayer['id'], painter: IPainter): void;
|
17
18
|
updateLayer(id: ILayer['id'], updateData?: ILayerUpdate): Promise<unknown>;
|
18
19
|
removePainter(id: IPainter['id']): void;
|
@@ -6,9 +6,11 @@ export interface IPainter {
|
|
6
6
|
drawType: TDrawType;
|
7
7
|
id: string;
|
8
8
|
name: string;
|
9
|
+
order?: number;
|
9
10
|
}
|
10
11
|
export interface IPutPainter {
|
11
|
-
name?:
|
12
|
+
name?: IPainter['name'];
|
13
|
+
order?: IPainter['order'];
|
12
14
|
}
|
13
15
|
export interface ISmoothFilterOptions {
|
14
16
|
useStore: boolean;
|
package/dist/utils/painter.d.ts
CHANGED
@@ -7,6 +7,11 @@ export default class Painter {
|
|
7
7
|
drawType: TDrawType;
|
8
8
|
id: string;
|
9
9
|
name: string;
|
10
|
+
order: number | null;
|
11
|
+
createdAt: {
|
12
|
+
view: Date;
|
13
|
+
digital: number;
|
14
|
+
};
|
10
15
|
constructor(drawLayersService: DrawLayersService, createModel: IPainter);
|
11
|
-
putPainter(painter: IPutPainter):
|
16
|
+
putPainter(painter: IPutPainter): Promise<unknown>;
|
12
17
|
}
|