canvas-editor-engine 2.1.28 → 2.1.29
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/config.d.ts +2 -0
- package/dist/index.mjs +10 -0
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
@@ -9,7 +9,9 @@ export declare class ConfigFabric {
|
|
9
9
|
protected _ZOOM: number;
|
10
10
|
}
|
11
11
|
export default class AppConfig extends ConfigFabric {
|
12
|
+
private _canvas;
|
12
13
|
constructor();
|
14
|
+
bindCanvas(canvasElement: HTMLDivElement): void;
|
13
15
|
get CANVAS_SIZE(): ICanvasSize;
|
14
16
|
set CANVAS_SIZE(value: ICanvasSize | undefined);
|
15
17
|
get LAYERS(): ILayer[];
|
package/dist/index.mjs
CHANGED
@@ -69,6 +69,7 @@ var AppConfig = function(_super) {
|
|
69
69
|
__extends(AppConfig, _super);
|
70
70
|
function AppConfig() {
|
71
71
|
var _this = _super.call(this) || this;
|
72
|
+
_this._canvas = null;
|
72
73
|
_this._CANVAS_SIZE = {
|
73
74
|
width: 300,
|
74
75
|
height: 150
|
@@ -86,6 +87,10 @@ var AppConfig = function(_super) {
|
|
86
87
|
_this._ZOOM = 1;
|
87
88
|
return _this;
|
88
89
|
}
|
90
|
+
AppConfig.prototype.bindCanvas = function(canvasElement) {
|
91
|
+
var canvas = canvasElement.querySelector("canvas");
|
92
|
+
this._canvas = canvas;
|
93
|
+
};
|
89
94
|
Object.defineProperty(AppConfig.prototype, "CANVAS_SIZE", {
|
90
95
|
get: function() {
|
91
96
|
return this._CANVAS_SIZE;
|
@@ -93,6 +98,10 @@ var AppConfig = function(_super) {
|
|
93
98
|
set: function(value) {
|
94
99
|
if (!!value && !!(value === null || value === void 0 ? void 0 : value.width) && !!(value === null || value === void 0 ? void 0 : value.height)) {
|
95
100
|
this._CANVAS_SIZE = value;
|
101
|
+
if (!!this._canvas) {
|
102
|
+
this._canvas.width = value.width;
|
103
|
+
this._canvas.height = value.height;
|
104
|
+
}
|
96
105
|
} else {
|
97
106
|
console.warn("CANVAS_SIZE denied");
|
98
107
|
}
|
@@ -2197,6 +2206,7 @@ var WebComponent = function(_super) {
|
|
2197
2206
|
return this.initial();
|
2198
2207
|
};
|
2199
2208
|
WebComponent.prototype.initial = function() {
|
2209
|
+
this.appConfig.bindCanvas(this.canvasElement);
|
2200
2210
|
return {
|
2201
2211
|
editorElement: this.canvasElement,
|
2202
2212
|
canvasSelector: this.canvasComponent.getCanvasSelector()
|