canvas-editor-engine 2.3.16 → 2.3.17
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
@@ -2201,7 +2201,7 @@ var DrawAccumulator = function() {
|
|
2201
2201
|
}));
|
2202
2202
|
}));
|
2203
2203
|
};
|
2204
|
-
DrawAccumulator.prototype.
|
2204
|
+
DrawAccumulator.prototype.removePainter = function(id) {
|
2205
2205
|
return __awaiter(this, void 0, void 0, (function() {
|
2206
2206
|
var painter;
|
2207
2207
|
return __generator(this, (function(_a) {
|
@@ -2213,6 +2213,25 @@ var DrawAccumulator = function() {
|
|
2213
2213
|
return painter.id !== id;
|
2214
2214
|
}));
|
2215
2215
|
}
|
2216
|
+
this.drawLayersService.removePainter(id);
|
2217
|
+
return [ 2 ];
|
2218
|
+
}));
|
2219
|
+
}));
|
2220
|
+
};
|
2221
|
+
DrawAccumulator.prototype.smoothFilter = function(painterId, smoothFilterOptions) {
|
2222
|
+
return __awaiter(this, void 0, void 0, (function() {
|
2223
|
+
var useStore, options, filterOptions, painter;
|
2224
|
+
var _this = this;
|
2225
|
+
return __generator(this, (function(_a) {
|
2226
|
+
useStore = smoothFilterOptions.useStore, options = smoothFilterOptions.options,
|
2227
|
+
filterOptions = smoothFilterOptions.filterOptions;
|
2228
|
+
painter = this.painters.find((function(painter) {
|
2229
|
+
return painter.id === painterId;
|
2230
|
+
}));
|
2231
|
+
if (!painter) return [ 2 ];
|
2232
|
+
painter.drawService.drawSmoothImage(useStore, options, filterOptions).then((function() {
|
2233
|
+
_this.update();
|
2234
|
+
}));
|
2216
2235
|
return [ 2 ];
|
2217
2236
|
}));
|
2218
2237
|
}));
|
@@ -2396,16 +2415,22 @@ var DrawService = function() {
|
|
2396
2415
|
}));
|
2397
2416
|
};
|
2398
2417
|
DrawService.prototype.drawSmoothImage = function(useStore, options, filterOptions) {
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
|
2405
|
-
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2418
|
+
return __awaiter(this, void 0, void 0, (function() {
|
2419
|
+
var filterArgs;
|
2420
|
+
var _this = this;
|
2421
|
+
return __generator(this, (function(_a) {
|
2422
|
+
filterArgs = this.getFilterArgs(useStore, options);
|
2423
|
+
this.eventService.dispatch("loading-start");
|
2424
|
+
if (!this.imageProcessor) {
|
2425
|
+
throw new Error("No valid ImageProcessor instance found");
|
2426
|
+
}
|
2427
|
+
return [ 2, this.imageProcessor.vague(filterArgs, filterOptions).then((function(data) {
|
2428
|
+
_this.updateImageStateAfterVague(data);
|
2429
|
+
return data;
|
2430
|
+
})).finally((function() {
|
2431
|
+
return _this.eventService.dispatch("loading-end");
|
2432
|
+
})) ];
|
2433
|
+
}));
|
2409
2434
|
}));
|
2410
2435
|
};
|
2411
2436
|
DrawService.prototype.updateImageStateAfterVague = function(data) {
|
@@ -2617,6 +2642,19 @@ var DrawLayersService = function() {
|
|
2617
2642
|
this.layerList[layerIndex] = layer;
|
2618
2643
|
this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", layer);
|
2619
2644
|
};
|
2645
|
+
DrawLayersService.prototype.removePainter = function(id) {
|
2646
|
+
var layerIndex = this.layerList.findIndex((function(layer) {
|
2647
|
+
return layer.painters.find((function(painter) {
|
2648
|
+
return painter.id === id;
|
2649
|
+
}));
|
2650
|
+
}));
|
2651
|
+
if (layerIndex === -1) return;
|
2652
|
+
this.layerList[layerIndex].painters = this.layerList[layerIndex].painters.filter((function(painter) {
|
2653
|
+
return painter.id !== id;
|
2654
|
+
}));
|
2655
|
+
var layer = this.layerList[layerIndex];
|
2656
|
+
this.appStoreRepository.store.drawLayersState.reduce("UPDATE_LAYER", layer);
|
2657
|
+
};
|
2620
2658
|
return DrawLayersService;
|
2621
2659
|
}();
|
2622
2660
|
|
@@ -2,7 +2,7 @@ import AppConfig from "../config";
|
|
2
2
|
import { IImageStateReduce } from "../store/image.state";
|
3
3
|
import AppStoreRepository from "../store/storeRepository";
|
4
4
|
import { ILayer } from "../types/draw-layers";
|
5
|
-
import { IPainter, TDrawType } from "../types/draw-service";
|
5
|
+
import { IPainter, ISmoothFilterOptions, TDrawType } from "../types/draw-service";
|
6
6
|
import type { IDrawImageArgs, IDrawImageProcessor, IFilterOptions, IImageLoggingDataVague, IImageOptions } from "../types/image";
|
7
7
|
import { Project } from "../types/project";
|
8
8
|
import { ITempCanvasOptions } from "../types/temp-canvas";
|
@@ -17,7 +17,8 @@ export declare class DrawAccumulator {
|
|
17
17
|
painters: IPainter[];
|
18
18
|
constructor(appConfig: AppConfig, appStoreRepository: AppStoreRepository, eventService: EventService, drawLayersService: DrawLayersService);
|
19
19
|
add<DrawType extends TDrawType>(layerId: ILayer['id'], drawType: DrawType, options: DrawService['options'][DrawType], initialSize: ITempCanvasOptions): Promise<void>;
|
20
|
-
|
20
|
+
removePainter(id: string): Promise<void>;
|
21
|
+
smoothFilter(painterId: IPainter['id'], smoothFilterOptions: ISmoothFilterOptions): Promise<void>;
|
21
22
|
private update;
|
22
23
|
private get gradient();
|
23
24
|
private clearCanvas;
|
@@ -49,7 +50,7 @@ export default class DrawService {
|
|
49
50
|
reduceData: IImageStateReduce | null;
|
50
51
|
message: string | null;
|
51
52
|
}>;
|
52
|
-
drawSmoothImage(useStore: boolean, options: IDrawImageArgs, filterOptions: IFilterOptions):
|
53
|
+
drawSmoothImage(useStore: boolean, options: IDrawImageArgs, filterOptions: IFilterOptions): Promise<IImageLoggingDataVague>;
|
53
54
|
updateImageStateAfterVague(data: IImageLoggingDataVague): void;
|
54
55
|
getFilterArgs(useStore: boolean, options: IDrawImageArgs): IImageOptions;
|
55
56
|
}
|
@@ -1,7 +1,13 @@
|
|
1
1
|
import DrawService from "../services/draw.service";
|
2
|
+
import { IDrawImageArgs, IFilterOptions } from "./image";
|
2
3
|
export type TDrawType = keyof DrawService['options'];
|
3
4
|
export interface IPainter {
|
4
5
|
drawService: DrawService;
|
5
6
|
drawType: TDrawType;
|
6
7
|
id: string;
|
7
8
|
}
|
9
|
+
export interface ISmoothFilterOptions {
|
10
|
+
useStore: boolean;
|
11
|
+
options: IDrawImageArgs;
|
12
|
+
filterOptions: IFilterOptions;
|
13
|
+
}
|