canvas-editor-engine 1.0.37 → 1.0.38
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.
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const excretions_component_1 = require("../components/excretions.component");
|
4
|
+
const config_1 = require("../config");
|
4
5
|
const filter_1 = require("../utils/filter");
|
5
6
|
class CropService {
|
6
7
|
static setup() {
|
@@ -13,7 +14,11 @@ class CropService {
|
|
13
14
|
const filter = new filter_1.Filter(ctx);
|
14
15
|
const options = CropService.options;
|
15
16
|
const imageData = filter.copy(options);
|
16
|
-
|
17
|
+
const putOptions = {
|
18
|
+
x: (config_1.default.CANVAS_SIZE.width / 2) - (options.width / 2),
|
19
|
+
y: (config_1.default.CANVAS_SIZE.height / 2) - (options.height / 2),
|
20
|
+
};
|
21
|
+
filter.update(imageData, putOptions);
|
17
22
|
}
|
18
23
|
static viewCropButton() {
|
19
24
|
const cropButtons = excretions_component_1.default.excretionWrap.querySelectorAll('.crop-button');
|
package/dist/utils/filter.js
CHANGED
@@ -20,6 +20,7 @@ class Filter {
|
|
20
20
|
return imgData;
|
21
21
|
}
|
22
22
|
update(imgData, options) {
|
23
|
+
this.ctx.clearRect(0, 0, config_1.default.CANVAS_SIZE.width, config_1.default.CANVAS_SIZE.height);
|
23
24
|
this.ctx.putImageData(imgData, options.x, options.y);
|
24
25
|
}
|
25
26
|
getBuffCollection(imageData) {
|