canvas-editor-engine 2.3.37 → 2.3.39
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 +56 -48
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2562,51 +2562,52 @@ var Painter = function() {
|
|
2562
2562
|
return Painter;
|
2563
2563
|
}();
|
2564
2564
|
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
if (
|
2578
|
-
|
2579
|
-
|
2580
|
-
return true;
|
2565
|
+
function createDynamicPainterStore() {
|
2566
|
+
return new Proxy([], {
|
2567
|
+
get: function(target, name) {
|
2568
|
+
return target[name];
|
2569
|
+
},
|
2570
|
+
set: function(target, name, value) {
|
2571
|
+
try {
|
2572
|
+
if (typeof (value === null || value === void 0 ? void 0 : value.object) !== "undefined") {
|
2573
|
+
target[name] = value.object;
|
2574
|
+
value.update();
|
2575
|
+
return true;
|
2576
|
+
} else {
|
2577
|
+
if (name != "length") {
|
2578
|
+
console.warn("Proxy set error: object denied");
|
2579
|
+
return false;
|
2581
2580
|
} else {
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
var MIN_LENGTH = -1;
|
2587
|
-
var MAX_LENGTH = __spreadArray([], Object.keys(target), true);
|
2588
|
-
if (value <= Math.max.apply(Math, __spreadArray([ MIN_LENGTH ], MAX_LENGTH, false)) + 1) {
|
2589
|
-
target.length = value;
|
2590
|
-
}
|
2581
|
+
var MIN_LENGTH = -1;
|
2582
|
+
var MAX_LENGTH = __spreadArray([], Object.keys(target), true);
|
2583
|
+
if (value <= Math.max.apply(Math, __spreadArray([ MIN_LENGTH ], MAX_LENGTH, false)) + 1) {
|
2584
|
+
target.length = value;
|
2591
2585
|
}
|
2592
|
-
return true;
|
2593
2586
|
}
|
2594
|
-
} catch (error) {
|
2595
|
-
console.error("Proxy set error:", error);
|
2596
|
-
return false;
|
2597
|
-
}
|
2598
|
-
},
|
2599
|
-
deleteProperty: function(target, prop) {
|
2600
|
-
if (prop in target) {
|
2601
|
-
delete target[prop];
|
2602
|
-
target.length--;
|
2603
|
-
console.log("from:", target);
|
2604
|
-
console.log("property removed: ".concat(prop));
|
2605
2587
|
return true;
|
2606
2588
|
}
|
2589
|
+
} catch (error) {
|
2590
|
+
console.error("Proxy set error:", error);
|
2607
2591
|
return false;
|
2608
2592
|
}
|
2609
|
-
}
|
2593
|
+
},
|
2594
|
+
deleteProperty: function(target, prop) {
|
2595
|
+
if (prop in target) {
|
2596
|
+
delete target[prop];
|
2597
|
+
return true;
|
2598
|
+
}
|
2599
|
+
return false;
|
2600
|
+
}
|
2601
|
+
});
|
2602
|
+
}
|
2603
|
+
|
2604
|
+
var DrawAccumulatorService = function() {
|
2605
|
+
function DrawAccumulatorService(appConfig, appStoreRepository, eventService, drawLayersService) {
|
2606
|
+
this.appConfig = appConfig;
|
2607
|
+
this.appStoreRepository = appStoreRepository;
|
2608
|
+
this.eventService = eventService;
|
2609
|
+
this.drawLayersService = drawLayersService;
|
2610
|
+
this.painters = createDynamicPainterStore();
|
2610
2611
|
}
|
2611
2612
|
DrawAccumulatorService.prototype.add = function(layerId, drawType, options, initialSize) {
|
2612
2613
|
return __awaiter(this, void 0, void 0, (function() {
|
@@ -2634,19 +2635,26 @@ var DrawAccumulatorService = function() {
|
|
2634
2635
|
};
|
2635
2636
|
DrawAccumulatorService.prototype.removePainter = function(painterId) {
|
2636
2637
|
return __awaiter(this, void 0, void 0, (function() {
|
2637
|
-
var
|
2638
|
+
var painter, filteredPainters;
|
2639
|
+
var _this = this;
|
2638
2640
|
return __generator(this, (function(_a) {
|
2639
|
-
|
2640
|
-
painterIndex = this.painters.findIndex((function(painter) {
|
2641
|
+
painter = this.painters.find((function(painter) {
|
2641
2642
|
return painter.id === painterId;
|
2642
2643
|
}));
|
2643
|
-
if (
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2648
|
-
|
2649
|
-
|
2644
|
+
if (!painter) return [ 2, console.warn("Painter not found") ];
|
2645
|
+
filteredPainters = JSON.parse(JSON.stringify(this.painters.filter((function(painter) {
|
2646
|
+
return painter.id !== painterId;
|
2647
|
+
}))));
|
2648
|
+
if (!(filteredPainters === null || filteredPainters === void 0 ? void 0 : filteredPainters.length)) return [ 2, console.warn("Painter not found") ];
|
2649
|
+
this.painters = createDynamicPainterStore();
|
2650
|
+
filteredPainters.forEach((function(painter) {
|
2651
|
+
_this.painters.push({
|
2652
|
+
object: painter,
|
2653
|
+
update: _this.update.bind(_this)
|
2654
|
+
});
|
2655
|
+
}));
|
2656
|
+
this.drawLayersService.removePainter(painterId);
|
2657
|
+
this.update();
|
2650
2658
|
return [ 2 ];
|
2651
2659
|
}));
|
2652
2660
|
}));
|