canvas-editor-engine 2.1.29 → 2.1.31
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 +22 -0
- package/dist/services/serize.service.d.ts +10 -0
- package/dist/web-component.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2081,6 +2081,27 @@ 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 === null || currentRender === void 0 ? void 0 : currentRender.stateValue;
|
2092
|
+
if (!state) {
|
2093
|
+
return console.warn("No state");
|
2094
|
+
}
|
2095
|
+
this.appConfig.CANVAS_SIZE = size;
|
2096
|
+
this.updateCanvas(ctx, state);
|
2097
|
+
};
|
2098
|
+
ResizeService.prototype.updateCanvas = function(ctx, stateValue) {
|
2099
|
+
var filter = new Filter(this.appConfig, ctx);
|
2100
|
+
filter.update(stateValue.tempImageData, stateValue.position);
|
2101
|
+
};
|
2102
|
+
return ResizeService;
|
2103
|
+
}();
|
2104
|
+
|
2084
2105
|
reflect();
|
2085
2106
|
|
2086
2107
|
var WebComponentWrapper = function() {
|
@@ -2182,6 +2203,7 @@ var WebComponent = function(_super) {
|
|
2182
2203
|
this.toolService = new ToolService(this.canvasComponent);
|
2183
2204
|
this.appStoreRepository = new AppStoreRepository;
|
2184
2205
|
this.throughHistoryService = new ThroughHistoryService(this.appConfig, this.appStoreRepository);
|
2206
|
+
this.resizeService = new ResizeService(this.appConfig, this.throughHistoryService);
|
2185
2207
|
this.appStore = new AppStore(this.throughHistoryService, this.appStoreRepository);
|
2186
2208
|
this.pullProjectService = new PullProjectService(this.throughHistoryService, this.appStoreRepository);
|
2187
2209
|
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
|
+
}
|
package/dist/web-component.d.ts
CHANGED
@@ -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;
|