canvas-editor-engine 2.3.33 → 2.3.35
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 +15 -19
- 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[
|
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[
|
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
|
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
|
2589
|
+
target.length = value;
|
2596
2590
|
}
|
2597
2591
|
}
|
2598
2592
|
return true;
|
@@ -2621,7 +2615,7 @@ var DrawAccumulatorService = function() {
|
|
2621
2615
|
object: painter,
|
2622
2616
|
update: this.update.bind(this)
|
2623
2617
|
});
|
2624
|
-
console.log(
|
2618
|
+
console.log(this.painters);
|
2625
2619
|
this.drawLayersService.addToLayer(layerId, painter);
|
2626
2620
|
this.invokePainter(drawType, painter.drawService);
|
2627
2621
|
return [ 2 ];
|
@@ -2630,17 +2624,19 @@ var DrawAccumulatorService = function() {
|
|
2630
2624
|
};
|
2631
2625
|
DrawAccumulatorService.prototype.removePainter = function(painterId) {
|
2632
2626
|
return __awaiter(this, void 0, void 0, (function() {
|
2633
|
-
var
|
2627
|
+
var painterIndex;
|
2634
2628
|
return __generator(this, (function(_a) {
|
2635
|
-
|
2629
|
+
console.log(this.painters);
|
2630
|
+
painterIndex = this.painters.findIndex((function(painter) {
|
2636
2631
|
return painter.id === painterId;
|
2637
2632
|
}));
|
2638
|
-
if (
|
2639
|
-
this.painters
|
2640
|
-
|
2641
|
-
|
2633
|
+
if (painterIndex != -1) {
|
2634
|
+
delete this.painters[painterIndex];
|
2635
|
+
this.drawLayersService.removePainter(painterId);
|
2636
|
+
this.update();
|
2637
|
+
} else {
|
2638
|
+
console.warn("Painter not found");
|
2642
2639
|
}
|
2643
|
-
this.drawLayersService.removePainter(painterId);
|
2644
2640
|
return [ 2 ];
|
2645
2641
|
}));
|
2646
2642
|
}));
|