canvas-editor-engine 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const component_service_1 = require("../services/component.service");
|
4
|
+
class CropComponent extends component_service_1.default {
|
5
|
+
}
|
6
|
+
CropComponent.template = '';
|
7
|
+
CropComponent.css = '';
|
8
|
+
exports.default = CropComponent;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import ComponentService from "../services/component.service";
|
2
|
-
import type { IExcretionsCoords, TExcretionToolState } from "../types/excretion";
|
2
|
+
import type { IExcretionsCoords, TExcretionStyle, TExcretionToolState } from "../types/excretion";
|
3
3
|
export default class ExcretionsComponent extends ComponentService {
|
4
4
|
private static template;
|
5
5
|
private static css;
|
@@ -10,6 +10,10 @@ export default class ExcretionsComponent extends ComponentService {
|
|
10
10
|
private static _excretionToolState;
|
11
11
|
private static _tempCoords;
|
12
12
|
static excretionsCoords: IExcretionsCoords[];
|
13
|
+
private static _style;
|
14
|
+
static get style(): TExcretionStyle;
|
15
|
+
static set style(value: TExcretionStyle);
|
16
|
+
private static applyExcretionStyle;
|
13
17
|
private static tool;
|
14
18
|
static getComponent(): {
|
15
19
|
excretionsTemplate: HTMLElement;
|
@@ -5,6 +5,34 @@ 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 style() {
|
9
|
+
return ExcretionsComponent._style;
|
10
|
+
}
|
11
|
+
static set style(value) {
|
12
|
+
ExcretionsComponent._style = value;
|
13
|
+
ExcretionsComponent.applyExcretionStyle();
|
14
|
+
}
|
15
|
+
static applyExcretionStyle() {
|
16
|
+
if (ExcretionsComponent._style === 'crop') {
|
17
|
+
ExcretionsComponent._excretions.forEach((excretion) => {
|
18
|
+
if (!!excretion) {
|
19
|
+
if (!excretion.classList.contains('excretion_crop')) {
|
20
|
+
excretion.classList.add("excretion_crop");
|
21
|
+
}
|
22
|
+
}
|
23
|
+
});
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
ExcretionsComponent._excretions.forEach((excretion) => {
|
27
|
+
if (!!excretion) {
|
28
|
+
if (excretion.classList.contains('excretion_crop')) {
|
29
|
+
excretion.classList.remove("excretion_crop");
|
30
|
+
}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}
|
35
|
+
;
|
8
36
|
static getComponent() {
|
9
37
|
const wrapOptions = {
|
10
38
|
className: 'excretions-wrap',
|
@@ -17,6 +45,7 @@ class ExcretionsComponent extends component_service_1.default {
|
|
17
45
|
}
|
18
46
|
static set excretionState(state) {
|
19
47
|
ExcretionsComponent._excretionState = state;
|
48
|
+
ExcretionsComponent.applyExcretionStyle();
|
20
49
|
switch (state) {
|
21
50
|
case 'abandoned':
|
22
51
|
canvas_component_1.default.cursorStyle = 'default';
|
@@ -97,6 +126,7 @@ class ExcretionsComponent extends component_service_1.default {
|
|
97
126
|
};
|
98
127
|
ExcretionsComponent._tempCoords.push(tempStart);
|
99
128
|
}
|
129
|
+
ExcretionsComponent.applyExcretionStyle();
|
100
130
|
ExcretionsComponent._excretionActivity = 'active';
|
101
131
|
});
|
102
132
|
canvas_component_1.default.subscribe('mousemove', (event, cursorPosition) => {
|
@@ -165,6 +195,10 @@ ExcretionsComponent.css = `
|
|
165
195
|
animation: border-dance 1s infinite linear;
|
166
196
|
}
|
167
197
|
|
198
|
+
.excretion_crop {
|
199
|
+
box-shadow: 0px 0px 0px 100% rgba(34, 60, 80, 0.2);
|
200
|
+
}
|
201
|
+
|
168
202
|
@keyframes border-dance {
|
169
203
|
0% {
|
170
204
|
background-position: left top, right bottom, left bottom, right top;
|
@@ -180,6 +214,7 @@ ExcretionsComponent._excretionActivity = 'abandoned';
|
|
180
214
|
ExcretionsComponent._excretionToolState = 'abandoned';
|
181
215
|
ExcretionsComponent._tempCoords = [];
|
182
216
|
ExcretionsComponent.excretionsCoords = [];
|
217
|
+
ExcretionsComponent._style = 'default';
|
183
218
|
ExcretionsComponent.tool = {
|
184
219
|
id: 1,
|
185
220
|
name: 'excretion',
|
@@ -24,3 +24,4 @@ export type TExcretionTempCoords = (IExcretionTempStart | IExcretionTempEnd)[];
|
|
24
24
|
export type TExcretionToolState = 'taken' | 'abandoned';
|
25
25
|
export type TExcretionState = 'create' | 'add' | 'remove' | 'abandoned';
|
26
26
|
export type TExcretionActivity = 'active' | 'end' | 'abandoned';
|
27
|
+
export type TExcretionStyle = 'default' | 'crop';
|