canvas-editor-engine 1.0.26 → 1.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_1 = require("../config");
4
4
  const component_service_1 = require("../services/component.service");
5
5
  const logger_service_1 = require("../services/logger.service");
6
+ const tool_layers_service_1 = require("../services/tool-layers.service");
6
7
  class CanvasComponent extends component_service_1.default {
7
8
  static template = `
8
9
  <div id="event-listener"></div>
@@ -11,7 +12,7 @@ class CanvasComponent extends component_service_1.default {
11
12
  static css = `
12
13
  #event-listener {
13
14
  position: absolute;
14
- z-index: 10000;
15
+ z-index: ${tool_layers_service_1.ToolLayer.getLayerIndex('normal')};
15
16
  }
16
17
  `;
17
18
  static eventListener;
@@ -5,6 +5,7 @@ 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
  const crop_service_1 = require("../services/crop.service");
8
+ const tool_layers_service_1 = require("../services/tool-layers.service");
8
9
  class ExcretionsComponent extends component_service_1.default {
9
10
  static template = ``;
10
11
  static templateExcretion = `
@@ -22,6 +23,7 @@ class ExcretionsComponent extends component_service_1.default {
22
23
  background-size: 8px 1px, 8px 1px, 1px 8px, 1px 8px;
23
24
  background-position: left top, right bottom, left bottom, right top;
24
25
  animation: border-dance 1s infinite linear;
26
+ z-index: ${tool_layers_service_1.ToolLayer.getLayerIndex('low')};
25
27
  }
26
28
 
27
29
  .excretion_crop {
@@ -42,6 +44,7 @@ class ExcretionsComponent extends component_service_1.default {
42
44
  width: 30px;
43
45
  height: 30px;
44
46
  cursor: pointer;
47
+ z-index: ${tool_layers_service_1.ToolLayer.getLayerIndex('high')};
45
48
  }
46
49
 
47
50
  .crop-button--view {
package/dist/config.d.ts CHANGED
@@ -1,15 +1,23 @@
1
1
  import { ICanvasSize } from "./types/canvas";
2
- export interface IConfigStore {
3
- _WEB_COMPONENT_TAG_NAME: string;
4
- _CANVAS_SIZE: ICanvasSize;
2
+ export interface ILayer {
3
+ name: string;
4
+ index: number;
5
5
  }
6
- export declare class ConfigFabric {
6
+ export declare abstract class ConfigStore {
7
+ static _WEB_COMPONENT_TAG_NAME: string;
8
+ static _CANVAS_SIZE: ICanvasSize;
9
+ static _LAYERS: ILayer[];
10
+ }
11
+ export declare class ConfigFabric implements ConfigStore {
7
12
  protected static _WEB_COMPONENT_TAG_NAME: string;
8
13
  protected static _CANVAS_SIZE: ICanvasSize;
14
+ protected static _LAYERS: ILayer[];
9
15
  }
10
16
  export default class AppConfig extends ConfigFabric {
11
17
  static get WEB_COMPONENT_TAG_NAME(): string;
12
18
  static set WEB_COMPONENT_TAG_NAME(value: string | undefined);
13
19
  static get CANVAS_SIZE(): ICanvasSize;
14
20
  static set CANVAS_SIZE(value: ICanvasSize | undefined);
21
+ static get LAYERS(): ILayer[];
22
+ static set LAYERS(value: ILayer[]);
15
23
  }
package/dist/config.js CHANGED
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigFabric = void 0;
3
+ exports.ConfigFabric = exports.ConfigStore = void 0;
4
+ ;
5
+ class ConfigStore {
6
+ static _WEB_COMPONENT_TAG_NAME;
7
+ static _CANVAS_SIZE;
8
+ static _LAYERS;
9
+ }
10
+ exports.ConfigStore = ConfigStore;
4
11
  class ConfigFabric {
5
12
  static _WEB_COMPONENT_TAG_NAME;
6
13
  static _CANVAS_SIZE;
14
+ static _LAYERS;
7
15
  }
8
16
  exports.ConfigFabric = ConfigFabric;
9
17
  class AppConfig extends ConfigFabric {
@@ -13,6 +21,20 @@ class AppConfig extends ConfigFabric {
13
21
  height: 150,
14
22
  };
15
23
  AppConfig._WEB_COMPONENT_TAG_NAME = 'canvas-editor-engine';
24
+ AppConfig._LAYERS = [
25
+ {
26
+ name: 'low',
27
+ index: 1,
28
+ },
29
+ {
30
+ name: 'normal',
31
+ index: 2,
32
+ },
33
+ {
34
+ name: 'high',
35
+ index: 3,
36
+ }
37
+ ];
16
38
  }
17
39
  static get WEB_COMPONENT_TAG_NAME() {
18
40
  return AppConfig._WEB_COMPONENT_TAG_NAME;
@@ -33,5 +55,13 @@ class AppConfig extends ConfigFabric {
33
55
  console.warn('CANVAS_SIZE denied');
34
56
  }
35
57
  }
58
+ static get LAYERS() {
59
+ return AppConfig._LAYERS;
60
+ }
61
+ static set LAYERS(value) {
62
+ if (!!value && !!value?.length) {
63
+ AppConfig._LAYERS = value;
64
+ }
65
+ }
36
66
  }
37
67
  exports.default = AppConfig;
@@ -0,0 +1,4 @@
1
+ export declare class ToolLayer {
2
+ static multiplier: 1000;
3
+ static getLayerIndex(layerName: string): number;
4
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ToolLayer = void 0;
4
+ const config_1 = require("../config");
5
+ class ToolLayer {
6
+ static multiplier;
7
+ static getLayerIndex(layerName) {
8
+ const layer = config_1.default.LAYERS.find((layer) => layer.name === layerName);
9
+ const zIndex = ToolLayer.multiplier * layer.index;
10
+ return zIndex;
11
+ }
12
+ }
13
+ exports.ToolLayer = ToolLayer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",