canvas-editor-engine 2.3.33 → 2.3.34

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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -19
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -2564,24 +2564,18 @@ var Painter = function() {
2564
2564
 
2565
2565
  var DrawAccumulatorService = function() {
2566
2566
  function DrawAccumulatorService(appConfig, appStoreRepository, eventService, drawLayersService) {
2567
- var _this = this;
2568
2567
  this.appConfig = appConfig;
2569
2568
  this.appStoreRepository = appStoreRepository;
2570
2569
  this.eventService = eventService;
2571
2570
  this.drawLayersService = drawLayersService;
2572
- this.painters = new Proxy({
2573
- value: [],
2574
- filter: function(callback) {
2575
- _this.value = _this.value.filter(callback);
2576
- }
2577
- }, {
2571
+ this.painters = new Proxy([], {
2578
2572
  get: function(target, name) {
2579
- return target["value"][name];
2573
+ return target[name];
2580
2574
  },
2581
2575
  set: function(target, name, value) {
2582
2576
  try {
2583
2577
  if (typeof (value === null || value === void 0 ? void 0 : value.object) !== "undefined") {
2584
- target["value"][name] = value.object;
2578
+ target[name] = value.object;
2585
2579
  value.update();
2586
2580
  return true;
2587
2581
  } else {
@@ -2590,9 +2584,9 @@ var DrawAccumulatorService = function() {
2590
2584
  return false;
2591
2585
  } else {
2592
2586
  var MIN_LENGTH = -1;
2593
- var MAX_LENGTH = __spreadArray([], Object.keys(target["value"]), true);
2587
+ var MAX_LENGTH = __spreadArray([], Object.keys(target), true);
2594
2588
  if (value <= Math.max.apply(Math, __spreadArray([ MIN_LENGTH ], MAX_LENGTH, false)) + 1) {
2595
- target["value"].length = value;
2589
+ target.length = value;
2596
2590
  }
2597
2591
  }
2598
2592
  return true;
@@ -2621,7 +2615,6 @@ var DrawAccumulatorService = function() {
2621
2615
  object: painter,
2622
2616
  update: this.update.bind(this)
2623
2617
  });
2624
- console.log("this.painters", this.painters);
2625
2618
  this.drawLayersService.addToLayer(layerId, painter);
2626
2619
  this.invokePainter(drawType, painter.drawService);
2627
2620
  return [ 2 ];
@@ -2630,17 +2623,18 @@ var DrawAccumulatorService = function() {
2630
2623
  };
2631
2624
  DrawAccumulatorService.prototype.removePainter = function(painterId) {
2632
2625
  return __awaiter(this, void 0, void 0, (function() {
2633
- var painter;
2626
+ var painterIndex;
2634
2627
  return __generator(this, (function(_a) {
2635
- painter = this.painters.find((function(painter) {
2628
+ painterIndex = this.painters.findIndex((function(painter) {
2636
2629
  return painter.id === painterId;
2637
2630
  }));
2638
- if (!!painter) {
2639
- this.painters.filter((function(painter) {
2640
- return painter.id !== painterId;
2641
- }));
2631
+ if (painterIndex != -1) {
2632
+ delete this.painters[painterIndex];
2633
+ this.drawLayersService.removePainter(painterId);
2634
+ this.update();
2635
+ } else {
2636
+ console.warn("Painter not found");
2642
2637
  }
2643
- this.drawLayersService.removePainter(painterId);
2644
2638
  return [ 2 ];
2645
2639
  }));
2646
2640
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.3.33",
3
+ "version": "2.3.34",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",