canvas-editor-engine 2.3.36 → 2.3.38
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 +59 -47
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import ExecutionDelay from "execution-delay";
|
2
|
+
|
1
3
|
var extendStatics = function(d, b) {
|
2
4
|
extendStatics = Object.setPrototypeOf || {
|
3
5
|
__proto__: []
|
@@ -2562,49 +2564,52 @@ var Painter = function() {
|
|
2562
2564
|
return Painter;
|
2563
2565
|
}();
|
2564
2566
|
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
if (
|
2578
|
-
|
2579
|
-
|
2580
|
-
return true;
|
2567
|
+
function createDynamicPainterStore() {
|
2568
|
+
return new Proxy([], {
|
2569
|
+
get: function(target, name) {
|
2570
|
+
return target[name];
|
2571
|
+
},
|
2572
|
+
set: function(target, name, value) {
|
2573
|
+
try {
|
2574
|
+
if (typeof (value === null || value === void 0 ? void 0 : value.object) !== "undefined") {
|
2575
|
+
target[name] = value.object;
|
2576
|
+
value.update();
|
2577
|
+
return true;
|
2578
|
+
} else {
|
2579
|
+
if (name != "length") {
|
2580
|
+
console.warn("Proxy set error: object denied");
|
2581
|
+
return false;
|
2581
2582
|
} 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
|
-
}
|
2583
|
+
var MIN_LENGTH = -1;
|
2584
|
+
var MAX_LENGTH = __spreadArray([], Object.keys(target), true);
|
2585
|
+
if (value <= Math.max.apply(Math, __spreadArray([ MIN_LENGTH ], MAX_LENGTH, false)) + 1) {
|
2586
|
+
target.length = value;
|
2591
2587
|
}
|
2592
|
-
return true;
|
2593
2588
|
}
|
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
|
-
console.log("property removed: ".concat(prop));
|
2603
2589
|
return true;
|
2604
2590
|
}
|
2591
|
+
} catch (error) {
|
2592
|
+
console.error("Proxy set error:", error);
|
2605
2593
|
return false;
|
2606
2594
|
}
|
2607
|
-
}
|
2595
|
+
},
|
2596
|
+
deleteProperty: function(target, prop) {
|
2597
|
+
if (prop in target) {
|
2598
|
+
delete target[prop];
|
2599
|
+
return true;
|
2600
|
+
}
|
2601
|
+
return false;
|
2602
|
+
}
|
2603
|
+
});
|
2604
|
+
}
|
2605
|
+
|
2606
|
+
var DrawAccumulatorService = function() {
|
2607
|
+
function DrawAccumulatorService(appConfig, appStoreRepository, eventService, drawLayersService) {
|
2608
|
+
this.appConfig = appConfig;
|
2609
|
+
this.appStoreRepository = appStoreRepository;
|
2610
|
+
this.eventService = eventService;
|
2611
|
+
this.drawLayersService = drawLayersService;
|
2612
|
+
this.painters = createDynamicPainterStore();
|
2608
2613
|
}
|
2609
2614
|
DrawAccumulatorService.prototype.add = function(layerId, drawType, options, initialSize) {
|
2610
2615
|
return __awaiter(this, void 0, void 0, (function() {
|
@@ -2632,19 +2637,26 @@ var DrawAccumulatorService = function() {
|
|
2632
2637
|
};
|
2633
2638
|
DrawAccumulatorService.prototype.removePainter = function(painterId) {
|
2634
2639
|
return __awaiter(this, void 0, void 0, (function() {
|
2635
|
-
var
|
2640
|
+
var painter, filteredPainters;
|
2641
|
+
var _this = this;
|
2636
2642
|
return __generator(this, (function(_a) {
|
2637
|
-
|
2638
|
-
painterIndex = this.painters.findIndex((function(painter) {
|
2643
|
+
painter = this.painters.find((function(painter) {
|
2639
2644
|
return painter.id === painterId;
|
2640
2645
|
}));
|
2641
|
-
if (
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2646
|
+
if (!painter) return [ 2, console.warn("Painter not found") ];
|
2647
|
+
filteredPainters = JSON.parse(JSON.stringify(this.painters.filter((function(painter) {
|
2648
|
+
return painter.id !== painterId;
|
2649
|
+
}))));
|
2650
|
+
if (!(filteredPainters === null || filteredPainters === void 0 ? void 0 : filteredPainters.length)) return [ 2, console.warn("Painter not found") ];
|
2651
|
+
this.painters = createDynamicPainterStore();
|
2652
|
+
filteredPainters.forEach((function(painter) {
|
2653
|
+
_this.painters.push({
|
2654
|
+
object: painter,
|
2655
|
+
update: _this.update.bind(_this)
|
2656
|
+
});
|
2657
|
+
}));
|
2658
|
+
this.drawLayersService.removePainter(painterId);
|
2659
|
+
this.update();
|
2648
2660
|
return [ 2 ];
|
2649
2661
|
}));
|
2650
2662
|
}));
|
@@ -2693,7 +2705,7 @@ var DrawAccumulatorService = function() {
|
|
2693
2705
|
};
|
2694
2706
|
DrawAccumulatorService.prototype.update = function() {
|
2695
2707
|
var _this = this;
|
2696
|
-
|
2708
|
+
ExecutionDelay.add("[DrawAccumulatorService] update", (function() {
|
2697
2709
|
_this.clearCanvas();
|
2698
2710
|
_this.invokePaintersOnLayers();
|
2699
2711
|
}), 1e3);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "canvas-editor-engine",
|
3
|
-
"version": "2.3.
|
3
|
+
"version": "2.3.38",
|
4
4
|
"description": "CanvasEditorEngine library, use: [typescript] [canvas]",
|
5
5
|
"main": "dist/index.mjs",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -30,6 +30,7 @@
|
|
30
30
|
"typescript": "^5.7.2"
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
|
+
"execution-delay": "^1.0.3",
|
33
34
|
"rollup-plugin-multi-input": "^1.5.0",
|
34
35
|
"tslib": "^2.8.1"
|
35
36
|
}
|