canvas-editor-engine 1.0.36 → 1.0.37

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,7 @@
1
+ import { IImageOptions } from "../types/image";
1
2
  export default class CropService {
2
3
  static setup(): void;
3
- static crop(): void;
4
+ static crop(ctx: CanvasRenderingContext2D): void;
4
5
  static viewCropButton(): void;
5
- static get options(): {
6
- x: number;
7
- y: number;
8
- width: number;
9
- height: number;
10
- };
6
+ static get options(): IImageOptions;
11
7
  }
@@ -1,14 +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
6
  static setup() {
6
7
  excretions_component_1.default.additionStyle = 'crop';
7
8
  }
8
- static crop() {
9
+ static crop(ctx) {
9
10
  if (!!excretions_component_1.default.excretionsCoords?.length === false)
10
11
  return;
11
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);
12
17
  }
13
18
  static viewCropButton() {
14
19
  const cropButtons = excretions_component_1.default.excretionWrap.querySelectorAll('.crop-button');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",