canvas-editor-engine 1.0.10 → 1.0.12
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.
@@ -10,9 +10,9 @@ export default class ExcretionsComponent extends ComponentService {
|
|
10
10
|
private static _excretionToolState;
|
11
11
|
private static _tempCoords;
|
12
12
|
static excretionsCoords: IExcretionsCoords[];
|
13
|
-
private static
|
14
|
-
static get
|
15
|
-
static set
|
13
|
+
private static _additionStyle;
|
14
|
+
static get additionStyle(): TExcretionStyle;
|
15
|
+
static set additionStyle(value: TExcretionStyle);
|
16
16
|
private static applyExcretionStyle;
|
17
17
|
private static tool;
|
18
18
|
static getComponent(): {
|
@@ -5,15 +5,15 @@ const tool_service_1 = require("../services/tool.service");
|
|
5
5
|
const canvas_component_1 = require("./canvas.component");
|
6
6
|
const logger_service_1 = require("../services/logger.service");
|
7
7
|
class ExcretionsComponent extends component_service_1.default {
|
8
|
-
static get
|
9
|
-
return ExcretionsComponent.
|
8
|
+
static get additionStyle() {
|
9
|
+
return ExcretionsComponent._additionStyle;
|
10
10
|
}
|
11
|
-
static set
|
12
|
-
ExcretionsComponent.
|
11
|
+
static set additionStyle(value) {
|
12
|
+
ExcretionsComponent._additionStyle = value;
|
13
13
|
ExcretionsComponent.applyExcretionStyle();
|
14
14
|
}
|
15
15
|
static applyExcretionStyle() {
|
16
|
-
if (ExcretionsComponent.
|
16
|
+
if (ExcretionsComponent._additionStyle === 'crop') {
|
17
17
|
ExcretionsComponent._excretions.forEach((excretion) => {
|
18
18
|
if (!!excretion) {
|
19
19
|
if (!excretion.classList.contains('excretion_crop')) {
|
@@ -214,13 +214,16 @@ ExcretionsComponent._excretionActivity = 'abandoned';
|
|
214
214
|
ExcretionsComponent._excretionToolState = 'abandoned';
|
215
215
|
ExcretionsComponent._tempCoords = [];
|
216
216
|
ExcretionsComponent.excretionsCoords = [];
|
217
|
-
ExcretionsComponent.
|
217
|
+
ExcretionsComponent._additionStyle = 'default';
|
218
218
|
ExcretionsComponent.tool = {
|
219
219
|
id: 1,
|
220
220
|
name: 'excretion',
|
221
221
|
onAction: () => ExcretionsComponent.setToolState('taken'),
|
222
222
|
offAction: () => ExcretionsComponent.setToolState('abandoned'),
|
223
|
-
support: () =>
|
223
|
+
support: () => {
|
224
|
+
ExcretionsComponent.clearExcretionsCoords();
|
225
|
+
ExcretionsComponent.additionStyle = 'default';
|
226
|
+
},
|
224
227
|
};
|
225
228
|
(() => {
|
226
229
|
tool_service_1.default.add(ExcretionsComponent.tool);
|
@@ -3,8 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const excretions_component_1 = require("../components/excretions.component");
|
4
4
|
class CropService {
|
5
5
|
static crop() {
|
6
|
-
excretions_component_1.default.
|
7
|
-
console.log(
|
6
|
+
excretions_component_1.default.additionStyle = 'crop';
|
7
|
+
console.log(CropService.options);
|
8
|
+
}
|
9
|
+
static get options() {
|
10
|
+
const excretionLastIndex = excretions_component_1.default.excretionsCoords.length;
|
11
|
+
const coords = excretions_component_1.default.excretionsCoords[excretionLastIndex];
|
12
|
+
const excWidth = Math.abs(coords.start.x - coords.end.x);
|
13
|
+
const excHeight = Math.abs(coords.start.y - coords.end.y);
|
14
|
+
return {
|
15
|
+
x: coords.start.x,
|
16
|
+
y: coords.start.y,
|
17
|
+
width: excWidth,
|
18
|
+
height: excHeight,
|
19
|
+
};
|
8
20
|
}
|
9
21
|
}
|
10
22
|
exports.default = CropService;
|
package/dist/web-component.js
CHANGED
@@ -11,6 +11,7 @@ class WebComponentWrapper {
|
|
11
11
|
base.className = 'wc-editor';
|
12
12
|
base.style.position = 'relative';
|
13
13
|
base.style.display = 'flex';
|
14
|
+
base.style.overflow = 'hidden';
|
14
15
|
const stylesWrap = document.createElement('div');
|
15
16
|
stylesWrap.className = 'styles-wrap';
|
16
17
|
const editorWrap = document.createElement('div');
|