canvas-editor-engine 1.0.35 → 1.0.37
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,7 @@
|
|
1
|
+
import { IImageOptions } from "../types/image";
|
1
2
|
export default class CropService {
|
2
|
-
static
|
3
|
+
static setup(): void;
|
4
|
+
static crop(ctx: CanvasRenderingContext2D): void;
|
3
5
|
static viewCropButton(): void;
|
4
|
-
static get options():
|
5
|
-
x: number;
|
6
|
-
y: number;
|
7
|
-
width: number;
|
8
|
-
height: number;
|
9
|
-
};
|
6
|
+
static get options(): IImageOptions;
|
10
7
|
}
|
@@ -1,12 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const excretions_component_1 = require("../components/excretions.component");
|
4
|
+
const filter_1 = require("../utils/filter");
|
4
5
|
class CropService {
|
5
|
-
static
|
6
|
+
static setup() {
|
6
7
|
excretions_component_1.default.additionStyle = 'crop';
|
8
|
+
}
|
9
|
+
static crop(ctx) {
|
7
10
|
if (!!excretions_component_1.default.excretionsCoords?.length === false)
|
8
11
|
return;
|
9
12
|
console.log(CropService.options);
|
13
|
+
const filter = new filter_1.Filter(ctx);
|
14
|
+
const options = CropService.options;
|
15
|
+
const imageData = filter.copy(options);
|
16
|
+
filter.update(imageData, options);
|
10
17
|
}
|
11
18
|
static viewCropButton() {
|
12
19
|
const cropButtons = excretions_component_1.default.excretionWrap.querySelectorAll('.crop-button');
|