canvas-editor-engine 2.1.27 → 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 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
  }
@@ -1420,6 +1429,9 @@ var AppStore = function() {
1420
1429
  this.appStoreRepository.store.historyState.emerge(completeIt);
1421
1430
  }
1422
1431
  };
1432
+ AppStore.prototype.getHistoryLines = function() {
1433
+ return this.appStoreRepository.store.historyState.historyLines;
1434
+ };
1423
1435
  return AppStore;
1424
1436
  }();
1425
1437
 
@@ -2194,6 +2206,7 @@ var WebComponent = function(_super) {
2194
2206
  return this.initial();
2195
2207
  };
2196
2208
  WebComponent.prototype.initial = function() {
2209
+ this.appConfig.bindCanvas(this.canvasElement);
2197
2210
  return {
2198
2211
  editorElement: this.canvasElement,
2199
2212
  canvasSelector: this.canvasComponent.getCanvasSelector()
@@ -14,4 +14,5 @@ export default class AppStore {
14
14
  private appStoreRepository;
15
15
  constructor(throughHistoryService: ThroughHistoryService, appStoreRepository: AppStoreRepository);
16
16
  subscribe(to: 'history', completeIt: (...args: any) => void): void;
17
+ getHistoryLines(): import("../types/history").IHistoryLine[];
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.1.27",
3
+ "version": "2.1.29",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",