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 crop(): void;
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 crop() {
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.35",
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",