canvas-editor-engine 2.1.29 → 2.1.30

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.
package/dist/index.mjs CHANGED
@@ -2081,6 +2081,24 @@ var DownloadService = function() {
2081
2081
  return DownloadService;
2082
2082
  }();
2083
2083
 
2084
+ var ResizeService = function() {
2085
+ function ResizeService(appConfig, throughHistoryService) {
2086
+ this.appConfig = appConfig;
2087
+ this.throughHistoryService = throughHistoryService;
2088
+ }
2089
+ ResizeService.prototype.resize = function(ctx, size) {
2090
+ var currentRender = this.throughHistoryService.current();
2091
+ var state = currentRender.stateValue;
2092
+ this.appConfig.CANVAS_SIZE = size;
2093
+ this.updateCanvas(ctx, state);
2094
+ };
2095
+ ResizeService.prototype.updateCanvas = function(ctx, stateValue) {
2096
+ var filter = new Filter(this.appConfig, ctx);
2097
+ filter.update(stateValue.tempImageData, stateValue.position);
2098
+ };
2099
+ return ResizeService;
2100
+ }();
2101
+
2084
2102
  reflect();
2085
2103
 
2086
2104
  var WebComponentWrapper = function() {
@@ -2182,6 +2200,7 @@ var WebComponent = function(_super) {
2182
2200
  this.toolService = new ToolService(this.canvasComponent);
2183
2201
  this.appStoreRepository = new AppStoreRepository;
2184
2202
  this.throughHistoryService = new ThroughHistoryService(this.appConfig, this.appStoreRepository);
2203
+ this.resizeService = new ResizeService(this.appConfig, this.throughHistoryService);
2185
2204
  this.appStore = new AppStore(this.throughHistoryService, this.appStoreRepository);
2186
2205
  this.pullProjectService = new PullProjectService(this.throughHistoryService, this.appStoreRepository);
2187
2206
  this.drawService = new DrawService(this.appConfig, this.appStoreRepository, this.eventService);
@@ -0,0 +1,10 @@
1
+ import AppConfig from "../config";
2
+ import { ISize } from "../types/general";
3
+ import ThroughHistoryService from "./through-history.service";
4
+ export default class ResizeService {
5
+ private appConfig;
6
+ private throughHistoryService;
7
+ constructor(appConfig: AppConfig, throughHistoryService: ThroughHistoryService);
8
+ resize(ctx: CanvasRenderingContext2D, size: ISize): void;
9
+ private updateCanvas;
10
+ }
@@ -17,6 +17,7 @@ import ProjectsService from "./services/projects.service";
17
17
  import PullProjectService from "./services/pull-project.service";
18
18
  import DrawService from "./services/draw.service";
19
19
  import DownloadService from "./services/download.service";
20
+ import ResizeService from "./services/serize.service";
20
21
  export declare class WebComponentWrapper {
21
22
  baseElement: HTMLDivElement;
22
23
  editorWrapElement: HTMLDivElement;
@@ -60,6 +61,7 @@ export default class WebComponent extends HTMLElement {
60
61
  loggerService: LoggerService;
61
62
  drawService: DrawService;
62
63
  downloadService: DownloadService;
64
+ resizeService: ResizeService;
63
65
  constructor();
64
66
  init(appConfig: AppConfig): {
65
67
  editorElement: HTMLDivElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.1.29",
3
+ "version": "2.1.30",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",