canvas-editor-engine 1.0.10 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 _style;
14
- static get style(): TExcretionStyle;
15
- static set style(value: TExcretionStyle);
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 style() {
9
- return ExcretionsComponent._style;
8
+ static get additionStyle() {
9
+ return ExcretionsComponent._additionStyle;
10
10
  }
11
- static set style(value) {
12
- ExcretionsComponent._style = value;
11
+ static set additionStyle(value) {
12
+ ExcretionsComponent._additionStyle = value;
13
13
  ExcretionsComponent.applyExcretionStyle();
14
14
  }
15
15
  static applyExcretionStyle() {
16
- if (ExcretionsComponent._style === 'crop') {
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._style = 'default';
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: () => ExcretionsComponent.clearExcretionsCoords(),
223
+ support: () => {
224
+ ExcretionsComponent.clearExcretionsCoords();
225
+ ExcretionsComponent.additionStyle = 'default';
226
+ },
224
227
  };
225
228
  (() => {
226
229
  tool_service_1.default.add(ExcretionsComponent.tool);
@@ -1,3 +1,4 @@
1
1
  export default class CropService {
2
2
  static crop(): void;
3
+ private static get options();
3
4
  }
@@ -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.style = 'crop';
7
- console.log('ExcretionComponent.excretionsCoords', excretions_component_1.default.excretionsCoords);
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;
@@ -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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",