canvas-editor-engine 1.0.40 → 1.0.42
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.
@@ -20,12 +20,12 @@ class CropService {
|
|
20
20
|
y: (config_1.default.CANVAS_SIZE.height / 2) - (options.height / 2),
|
21
21
|
};
|
22
22
|
filter.update(imageData, putOptions);
|
23
|
+
store_1.default.store.imageState.tempImageData = imageData;
|
23
24
|
store_1.default.store.imageState.position = putOptions;
|
24
25
|
store_1.default.store.imageState.size = {
|
25
26
|
width: options.width,
|
26
27
|
height: options.height,
|
27
28
|
};
|
28
|
-
console.log('AppStore.store', store_1.default.store);
|
29
29
|
}
|
30
30
|
static viewCropButton() {
|
31
31
|
const cropButtons = excretions_component_1.default.excretionWrap.querySelectorAll('.crop-button');
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { IDrawImageArgs, IFilterOptions, IImageOptions } from "../types/image";
|
2
2
|
export default class DrawService {
|
3
3
|
static drawImage(ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs): void;
|
4
|
-
static drawSmoothImage(ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs, filterOptions: IFilterOptions): void;
|
4
|
+
static drawSmoothImage(useStore: boolean, ctx: CanvasRenderingContext2D, src: string, options: IDrawImageArgs, filterOptions: IFilterOptions): void;
|
5
|
+
private static getFilterArgs;
|
5
6
|
}
|
6
7
|
export declare class SCImage {
|
7
8
|
private img;
|
@@ -3,25 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SCImage = void 0;
|
4
4
|
const config_1 = require("../config");
|
5
5
|
const filters_1 = require("../filters");
|
6
|
+
const store_1 = require("../store/store");
|
6
7
|
class DrawService {
|
7
8
|
static drawImage(ctx, src, options) {
|
8
9
|
const img = new SCImage(src, ctx);
|
9
10
|
img.draw(options);
|
10
11
|
}
|
11
|
-
static drawSmoothImage(ctx, src, options, filterOptions) {
|
12
|
+
static drawSmoothImage(useStore, ctx, src, options, filterOptions) {
|
12
13
|
const img = new SCImage(src, ctx);
|
13
|
-
const filterArgs =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
const filterArgs = DrawService.getFilterArgs(useStore, options);
|
15
|
+
img.draw(options).then(() => img.vague(filterArgs, filterOptions));
|
16
|
+
}
|
17
|
+
static getFilterArgs(useStore, options) {
|
18
|
+
let filterArgs;
|
19
|
+
const store = store_1.default.store.imageState;
|
20
|
+
if (useStore) {
|
21
|
+
filterArgs = {
|
22
|
+
x: store.position.x,
|
23
|
+
y: store.position.y,
|
24
|
+
};
|
25
|
+
if (!!store.size.width && !!store.size.height) {
|
26
|
+
filterArgs.width = store.size.width;
|
27
|
+
filterArgs.height = store.size.height;
|
21
28
|
}
|
22
29
|
}
|
23
|
-
|
24
|
-
|
30
|
+
else {
|
31
|
+
filterArgs = {
|
32
|
+
x: options.position.x,
|
33
|
+
y: options.position.y,
|
34
|
+
};
|
35
|
+
if (options.size !== 'initial') {
|
36
|
+
if (!!options.size?.width && !!options.size?.height) {
|
37
|
+
filterArgs.width = options.size.width;
|
38
|
+
filterArgs.height = options.size.height;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
return filterArgs;
|
25
43
|
}
|
26
44
|
}
|
27
45
|
exports.default = DrawService;
|