canvas-editor-engine 1.0.45 → 1.0.47

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -8,6 +8,8 @@ import DrawService from "./services/draw.service";
8
8
  import ToolService from "./services/tool.service";
9
9
  import LoggerService from "./services/logger.service";
10
10
  import CropService from "./services/crop.service";
11
+ import DownloadService from "./services/download.service";
12
+ import ToolLayerService from "./services/tool-layers.service";
11
13
  declare class CanvasEditorEngine {
12
14
  constructor(webComponentTagName?: string);
13
15
  getInitial(): {
@@ -24,4 +26,4 @@ declare class VueCanvasEditorEngine extends CanvasEditorEngine {
24
26
  getContext2D(): CanvasRenderingContext2D;
25
27
  getCanvas(): HTMLCanvasElement;
26
28
  }
27
- export { AppConfig, PipetteComponent, CanvasComponent, ExcretionComponent, SlotComponent, ToolService, DrawService, LoggerService, CropService, StaticCanvasEditorEngine, VueCanvasEditorEngine, };
29
+ export { AppConfig, PipetteComponent, CanvasComponent, ExcretionComponent, SlotComponent, ToolService, DrawService, LoggerService, CropService, DownloadService, ToolLayerService, StaticCanvasEditorEngine, VueCanvasEditorEngine, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VueCanvasEditorEngine = exports.StaticCanvasEditorEngine = exports.CropService = exports.LoggerService = exports.DrawService = exports.ToolService = exports.SlotComponent = exports.ExcretionComponent = exports.CanvasComponent = exports.PipetteComponent = exports.AppConfig = void 0;
3
+ exports.VueCanvasEditorEngine = exports.StaticCanvasEditorEngine = exports.ToolLayerService = exports.DownloadService = exports.CropService = exports.LoggerService = exports.DrawService = exports.ToolService = exports.SlotComponent = exports.ExcretionComponent = exports.CanvasComponent = exports.PipetteComponent = exports.AppConfig = void 0;
4
4
  const config_1 = require("./config");
5
5
  exports.AppConfig = config_1.default;
6
6
  const web_component_1 = require("./web-component");
@@ -20,6 +20,10 @@ const logger_service_1 = require("./services/logger.service");
20
20
  exports.LoggerService = logger_service_1.default;
21
21
  const crop_service_1 = require("./services/crop.service");
22
22
  exports.CropService = crop_service_1.default;
23
+ const download_service_1 = require("./services/download.service");
24
+ exports.DownloadService = download_service_1.default;
25
+ const tool_layers_service_1 = require("./services/tool-layers.service");
26
+ exports.ToolLayerService = tool_layers_service_1.default;
23
27
  class CanvasEditorEngine {
24
28
  constructor(webComponentTagName) {
25
29
  config_1.default.WEB_COMPONENT_TAG_NAME = webComponentTagName;
@@ -0,0 +1,4 @@
1
+ export default class DownloadService {
2
+ static getDataUrl(): string;
3
+ static download(filename?: string): void;
4
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const canvas_component_1 = require("../components/canvas.component");
4
+ class DownloadService {
5
+ static getDataUrl() {
6
+ return canvas_component_1.default.canvas.toDataURL();
7
+ }
8
+ static download(filename) {
9
+ const link = document.createElement('a');
10
+ link.download = `${filename || 'image'}.png`;
11
+ link.href = DownloadService.getDataUrl();
12
+ link.click();
13
+ }
14
+ }
15
+ exports.default = DownloadService;
@@ -1,4 +1,4 @@
1
- export default class ToolLayer {
1
+ export default class ToolLayerService {
2
2
  static multiplier: number;
3
3
  static getLayerIndex(layerName: string): number;
4
4
  }
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_1 = require("../config");
4
- class ToolLayer {
4
+ class ToolLayerService {
5
5
  static multiplier = 1000;
6
6
  static getLayerIndex(layerName) {
7
7
  const layer = config_1.default.LAYERS.find((layer) => layer.name === layerName);
8
- const zIndex = ToolLayer.multiplier * layer.index;
8
+ const zIndex = ToolLayerService.multiplier * layer.index;
9
9
  return zIndex;
10
10
  }
11
11
  }
12
- exports.default = ToolLayer;
12
+ exports.default = ToolLayerService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",