@pooder/kit 5.0.1 → 5.0.2
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +37 -23
- package/dist/index.mjs +37 -23
- package/package.json +1 -1
- package/src/image.ts +38 -24
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -286,6 +286,7 @@ declare class ImageTool implements Extension {
|
|
|
286
286
|
private normalizeItem;
|
|
287
287
|
private normalizeItems;
|
|
288
288
|
private cloneItems;
|
|
289
|
+
private emitWorkingChange;
|
|
289
290
|
private generateId;
|
|
290
291
|
private getImageIdFromActiveObject;
|
|
291
292
|
private resolveReplaceTargetId;
|
package/dist/index.d.ts
CHANGED
|
@@ -286,6 +286,7 @@ declare class ImageTool implements Extension {
|
|
|
286
286
|
private normalizeItem;
|
|
287
287
|
private normalizeItems;
|
|
288
288
|
private cloneItems;
|
|
289
|
+
private emitWorkingChange;
|
|
289
290
|
private generateId;
|
|
290
291
|
private getImageIdFromActiveObject;
|
|
291
292
|
private resolveReplaceTargetId;
|
package/dist/index.js
CHANGED
|
@@ -3847,10 +3847,7 @@ var ImageTool = class {
|
|
|
3847
3847
|
context.eventBus.on("selection:created", this.onSelectionChanged);
|
|
3848
3848
|
context.eventBus.on("selection:updated", this.onSelectionChanged);
|
|
3849
3849
|
context.eventBus.on("selection:cleared", this.onSelectionCleared);
|
|
3850
|
-
context.eventBus.on(
|
|
3851
|
-
"scene:layout:change",
|
|
3852
|
-
this.onSceneLayoutChanged
|
|
3853
|
-
);
|
|
3850
|
+
context.eventBus.on("scene:layout:change", this.onSceneLayoutChanged);
|
|
3854
3851
|
const configService = context.services.get(
|
|
3855
3852
|
"ConfigurationService"
|
|
3856
3853
|
);
|
|
@@ -3890,10 +3887,7 @@ var ImageTool = class {
|
|
|
3890
3887
|
context.eventBus.off("selection:created", this.onSelectionChanged);
|
|
3891
3888
|
context.eventBus.off("selection:updated", this.onSelectionChanged);
|
|
3892
3889
|
context.eventBus.off("selection:cleared", this.onSelectionCleared);
|
|
3893
|
-
context.eventBus.off(
|
|
3894
|
-
"scene:layout:change",
|
|
3895
|
-
this.onSceneLayoutChanged
|
|
3896
|
-
);
|
|
3890
|
+
context.eventBus.off("scene:layout:change", this.onSceneLayoutChanged);
|
|
3897
3891
|
(_a = this.dirtyTrackerDisposable) == null ? void 0 : _a.dispose();
|
|
3898
3892
|
this.dirtyTrackerDisposable = void 0;
|
|
3899
3893
|
this.clearRenderedImages();
|
|
@@ -4002,7 +3996,7 @@ var ImageTool = class {
|
|
|
4002
3996
|
id: "image.frame.outerBackground",
|
|
4003
3997
|
type: "color",
|
|
4004
3998
|
label: "Image Frame Outer Background",
|
|
4005
|
-
default: "
|
|
3999
|
+
default: "#f5f5f5"
|
|
4006
4000
|
}
|
|
4007
4001
|
],
|
|
4008
4002
|
[import_core5.ContributionPointIds.COMMANDS]: [
|
|
@@ -4045,6 +4039,7 @@ var ImageTool = class {
|
|
|
4045
4039
|
this.workingItems = this.cloneItems(this.items);
|
|
4046
4040
|
this.hasWorkingChanges = false;
|
|
4047
4041
|
this.updateImages();
|
|
4042
|
+
this.emitWorkingChange();
|
|
4048
4043
|
}
|
|
4049
4044
|
},
|
|
4050
4045
|
{
|
|
@@ -4159,6 +4154,13 @@ var ImageTool = class {
|
|
|
4159
4154
|
cloneItems(items) {
|
|
4160
4155
|
return this.normalizeItems((items || []).map((i) => ({ ...i })));
|
|
4161
4156
|
}
|
|
4157
|
+
emitWorkingChange(changedId = null) {
|
|
4158
|
+
var _a;
|
|
4159
|
+
(_a = this.context) == null ? void 0 : _a.eventBus.emit("image:working:change", {
|
|
4160
|
+
changedId,
|
|
4161
|
+
items: this.cloneItems(this.workingItems)
|
|
4162
|
+
});
|
|
4163
|
+
}
|
|
4162
4164
|
generateId() {
|
|
4163
4165
|
return Math.random().toString(36).substring(2, 9);
|
|
4164
4166
|
}
|
|
@@ -4227,6 +4229,7 @@ var ImageTool = class {
|
|
|
4227
4229
|
if (this.workingItems.some((existing) => existing.id === item.id)) return;
|
|
4228
4230
|
this.workingItems = this.cloneItems([...this.workingItems, item]);
|
|
4229
4231
|
this.updateImages();
|
|
4232
|
+
this.emitWorkingChange(item.id);
|
|
4230
4233
|
}
|
|
4231
4234
|
async updateImage(id, updates, options = {}) {
|
|
4232
4235
|
this.syncToolActiveFromWorkbench();
|
|
@@ -4410,10 +4413,7 @@ var ImageTool = class {
|
|
|
4410
4413
|
"image.frame.innerBackground",
|
|
4411
4414
|
"rgba(0,0,0,0)"
|
|
4412
4415
|
) || "rgba(0,0,0,0)",
|
|
4413
|
-
outerBackground:
|
|
4414
|
-
"image.frame.outerBackground",
|
|
4415
|
-
"rgba(0,0,0,0.18)"
|
|
4416
|
-
) || "rgba(0,0,0,0.18)"
|
|
4416
|
+
outerBackground: "#f5f5f5"
|
|
4417
4417
|
};
|
|
4418
4418
|
}
|
|
4419
4419
|
resolveRenderImageState(item) {
|
|
@@ -4557,10 +4557,21 @@ var ImageTool = class {
|
|
|
4557
4557
|
const canvasW = this.canvasService.canvas.width || 0;
|
|
4558
4558
|
const canvasH = this.canvasService.canvas.height || 0;
|
|
4559
4559
|
const visual = this.getFrameVisualConfig();
|
|
4560
|
-
const
|
|
4561
|
-
const
|
|
4562
|
-
const
|
|
4563
|
-
|
|
4560
|
+
const frameLeft = Math.max(0, Math.min(canvasW, frame.left));
|
|
4561
|
+
const frameTop = Math.max(0, Math.min(canvasH, frame.top));
|
|
4562
|
+
const frameRight = Math.max(
|
|
4563
|
+
frameLeft,
|
|
4564
|
+
Math.min(canvasW, frame.left + frame.width)
|
|
4565
|
+
);
|
|
4566
|
+
const frameBottom = Math.max(
|
|
4567
|
+
frameTop,
|
|
4568
|
+
Math.min(canvasH, frame.top + frame.height)
|
|
4569
|
+
);
|
|
4570
|
+
const visibleFrameH = Math.max(0, frameBottom - frameTop);
|
|
4571
|
+
const topH = frameTop;
|
|
4572
|
+
const bottomH = Math.max(0, canvasH - frameBottom);
|
|
4573
|
+
const leftW = frameLeft;
|
|
4574
|
+
const rightW = Math.max(0, canvasW - frameRight);
|
|
4564
4575
|
const mask = [
|
|
4565
4576
|
{
|
|
4566
4577
|
id: "image.cropMask.top",
|
|
@@ -4584,7 +4595,7 @@ var ImageTool = class {
|
|
|
4584
4595
|
data: { id: "image.cropMask.bottom", zIndex: 2 },
|
|
4585
4596
|
props: {
|
|
4586
4597
|
left: canvasW / 2,
|
|
4587
|
-
top:
|
|
4598
|
+
top: frameBottom + bottomH / 2,
|
|
4588
4599
|
width: canvasW,
|
|
4589
4600
|
height: bottomH,
|
|
4590
4601
|
originX: "center",
|
|
@@ -4600,9 +4611,9 @@ var ImageTool = class {
|
|
|
4600
4611
|
data: { id: "image.cropMask.left", zIndex: 3 },
|
|
4601
4612
|
props: {
|
|
4602
4613
|
left: leftW / 2,
|
|
4603
|
-
top:
|
|
4614
|
+
top: frameTop + visibleFrameH / 2,
|
|
4604
4615
|
width: leftW,
|
|
4605
|
-
height:
|
|
4616
|
+
height: visibleFrameH,
|
|
4606
4617
|
originX: "center",
|
|
4607
4618
|
originY: "center",
|
|
4608
4619
|
fill: visual.outerBackground,
|
|
@@ -4615,10 +4626,10 @@ var ImageTool = class {
|
|
|
4615
4626
|
type: "rect",
|
|
4616
4627
|
data: { id: "image.cropMask.right", zIndex: 4 },
|
|
4617
4628
|
props: {
|
|
4618
|
-
left:
|
|
4619
|
-
top:
|
|
4629
|
+
left: frameRight + rightW / 2,
|
|
4630
|
+
top: frameTop + visibleFrameH / 2,
|
|
4620
4631
|
width: rightW,
|
|
4621
|
-
height:
|
|
4632
|
+
height: visibleFrameH,
|
|
4622
4633
|
originX: "center",
|
|
4623
4634
|
originY: "center",
|
|
4624
4635
|
fill: visual.outerBackground,
|
|
@@ -4708,6 +4719,7 @@ var ImageTool = class {
|
|
|
4708
4719
|
if (this.isToolActive) {
|
|
4709
4720
|
this.updateImages();
|
|
4710
4721
|
}
|
|
4722
|
+
this.emitWorkingChange(id);
|
|
4711
4723
|
}
|
|
4712
4724
|
async updateImageInConfig(id, updates) {
|
|
4713
4725
|
var _a, _b, _c, _d;
|
|
@@ -4788,6 +4800,7 @@ var ImageTool = class {
|
|
|
4788
4800
|
this.isImageSelectionActive = true;
|
|
4789
4801
|
this.focusedImageId = id;
|
|
4790
4802
|
this.updateImages();
|
|
4803
|
+
this.emitWorkingChange(id);
|
|
4791
4804
|
}
|
|
4792
4805
|
focusImageSelection(id) {
|
|
4793
4806
|
if (!this.canvasService) return;
|
|
@@ -4880,6 +4893,7 @@ var ImageTool = class {
|
|
|
4880
4893
|
this.hasWorkingChanges = false;
|
|
4881
4894
|
this.workingItems = this.cloneItems(next);
|
|
4882
4895
|
this.updateConfig(next);
|
|
4896
|
+
this.emitWorkingChange(focusId);
|
|
4883
4897
|
if (focusId) {
|
|
4884
4898
|
this.focusedImageId = focusId;
|
|
4885
4899
|
this.isImageSelectionActive = true;
|
package/dist/index.mjs
CHANGED
|
@@ -3798,10 +3798,7 @@ var ImageTool = class {
|
|
|
3798
3798
|
context.eventBus.on("selection:created", this.onSelectionChanged);
|
|
3799
3799
|
context.eventBus.on("selection:updated", this.onSelectionChanged);
|
|
3800
3800
|
context.eventBus.on("selection:cleared", this.onSelectionCleared);
|
|
3801
|
-
context.eventBus.on(
|
|
3802
|
-
"scene:layout:change",
|
|
3803
|
-
this.onSceneLayoutChanged
|
|
3804
|
-
);
|
|
3801
|
+
context.eventBus.on("scene:layout:change", this.onSceneLayoutChanged);
|
|
3805
3802
|
const configService = context.services.get(
|
|
3806
3803
|
"ConfigurationService"
|
|
3807
3804
|
);
|
|
@@ -3841,10 +3838,7 @@ var ImageTool = class {
|
|
|
3841
3838
|
context.eventBus.off("selection:created", this.onSelectionChanged);
|
|
3842
3839
|
context.eventBus.off("selection:updated", this.onSelectionChanged);
|
|
3843
3840
|
context.eventBus.off("selection:cleared", this.onSelectionCleared);
|
|
3844
|
-
context.eventBus.off(
|
|
3845
|
-
"scene:layout:change",
|
|
3846
|
-
this.onSceneLayoutChanged
|
|
3847
|
-
);
|
|
3841
|
+
context.eventBus.off("scene:layout:change", this.onSceneLayoutChanged);
|
|
3848
3842
|
(_a = this.dirtyTrackerDisposable) == null ? void 0 : _a.dispose();
|
|
3849
3843
|
this.dirtyTrackerDisposable = void 0;
|
|
3850
3844
|
this.clearRenderedImages();
|
|
@@ -3953,7 +3947,7 @@ var ImageTool = class {
|
|
|
3953
3947
|
id: "image.frame.outerBackground",
|
|
3954
3948
|
type: "color",
|
|
3955
3949
|
label: "Image Frame Outer Background",
|
|
3956
|
-
default: "
|
|
3950
|
+
default: "#f5f5f5"
|
|
3957
3951
|
}
|
|
3958
3952
|
],
|
|
3959
3953
|
[ContributionPointIds5.COMMANDS]: [
|
|
@@ -3996,6 +3990,7 @@ var ImageTool = class {
|
|
|
3996
3990
|
this.workingItems = this.cloneItems(this.items);
|
|
3997
3991
|
this.hasWorkingChanges = false;
|
|
3998
3992
|
this.updateImages();
|
|
3993
|
+
this.emitWorkingChange();
|
|
3999
3994
|
}
|
|
4000
3995
|
},
|
|
4001
3996
|
{
|
|
@@ -4110,6 +4105,13 @@ var ImageTool = class {
|
|
|
4110
4105
|
cloneItems(items) {
|
|
4111
4106
|
return this.normalizeItems((items || []).map((i) => ({ ...i })));
|
|
4112
4107
|
}
|
|
4108
|
+
emitWorkingChange(changedId = null) {
|
|
4109
|
+
var _a;
|
|
4110
|
+
(_a = this.context) == null ? void 0 : _a.eventBus.emit("image:working:change", {
|
|
4111
|
+
changedId,
|
|
4112
|
+
items: this.cloneItems(this.workingItems)
|
|
4113
|
+
});
|
|
4114
|
+
}
|
|
4113
4115
|
generateId() {
|
|
4114
4116
|
return Math.random().toString(36).substring(2, 9);
|
|
4115
4117
|
}
|
|
@@ -4178,6 +4180,7 @@ var ImageTool = class {
|
|
|
4178
4180
|
if (this.workingItems.some((existing) => existing.id === item.id)) return;
|
|
4179
4181
|
this.workingItems = this.cloneItems([...this.workingItems, item]);
|
|
4180
4182
|
this.updateImages();
|
|
4183
|
+
this.emitWorkingChange(item.id);
|
|
4181
4184
|
}
|
|
4182
4185
|
async updateImage(id, updates, options = {}) {
|
|
4183
4186
|
this.syncToolActiveFromWorkbench();
|
|
@@ -4361,10 +4364,7 @@ var ImageTool = class {
|
|
|
4361
4364
|
"image.frame.innerBackground",
|
|
4362
4365
|
"rgba(0,0,0,0)"
|
|
4363
4366
|
) || "rgba(0,0,0,0)",
|
|
4364
|
-
outerBackground:
|
|
4365
|
-
"image.frame.outerBackground",
|
|
4366
|
-
"rgba(0,0,0,0.18)"
|
|
4367
|
-
) || "rgba(0,0,0,0.18)"
|
|
4367
|
+
outerBackground: "#f5f5f5"
|
|
4368
4368
|
};
|
|
4369
4369
|
}
|
|
4370
4370
|
resolveRenderImageState(item) {
|
|
@@ -4508,10 +4508,21 @@ var ImageTool = class {
|
|
|
4508
4508
|
const canvasW = this.canvasService.canvas.width || 0;
|
|
4509
4509
|
const canvasH = this.canvasService.canvas.height || 0;
|
|
4510
4510
|
const visual = this.getFrameVisualConfig();
|
|
4511
|
-
const
|
|
4512
|
-
const
|
|
4513
|
-
const
|
|
4514
|
-
|
|
4511
|
+
const frameLeft = Math.max(0, Math.min(canvasW, frame.left));
|
|
4512
|
+
const frameTop = Math.max(0, Math.min(canvasH, frame.top));
|
|
4513
|
+
const frameRight = Math.max(
|
|
4514
|
+
frameLeft,
|
|
4515
|
+
Math.min(canvasW, frame.left + frame.width)
|
|
4516
|
+
);
|
|
4517
|
+
const frameBottom = Math.max(
|
|
4518
|
+
frameTop,
|
|
4519
|
+
Math.min(canvasH, frame.top + frame.height)
|
|
4520
|
+
);
|
|
4521
|
+
const visibleFrameH = Math.max(0, frameBottom - frameTop);
|
|
4522
|
+
const topH = frameTop;
|
|
4523
|
+
const bottomH = Math.max(0, canvasH - frameBottom);
|
|
4524
|
+
const leftW = frameLeft;
|
|
4525
|
+
const rightW = Math.max(0, canvasW - frameRight);
|
|
4515
4526
|
const mask = [
|
|
4516
4527
|
{
|
|
4517
4528
|
id: "image.cropMask.top",
|
|
@@ -4535,7 +4546,7 @@ var ImageTool = class {
|
|
|
4535
4546
|
data: { id: "image.cropMask.bottom", zIndex: 2 },
|
|
4536
4547
|
props: {
|
|
4537
4548
|
left: canvasW / 2,
|
|
4538
|
-
top:
|
|
4549
|
+
top: frameBottom + bottomH / 2,
|
|
4539
4550
|
width: canvasW,
|
|
4540
4551
|
height: bottomH,
|
|
4541
4552
|
originX: "center",
|
|
@@ -4551,9 +4562,9 @@ var ImageTool = class {
|
|
|
4551
4562
|
data: { id: "image.cropMask.left", zIndex: 3 },
|
|
4552
4563
|
props: {
|
|
4553
4564
|
left: leftW / 2,
|
|
4554
|
-
top:
|
|
4565
|
+
top: frameTop + visibleFrameH / 2,
|
|
4555
4566
|
width: leftW,
|
|
4556
|
-
height:
|
|
4567
|
+
height: visibleFrameH,
|
|
4557
4568
|
originX: "center",
|
|
4558
4569
|
originY: "center",
|
|
4559
4570
|
fill: visual.outerBackground,
|
|
@@ -4566,10 +4577,10 @@ var ImageTool = class {
|
|
|
4566
4577
|
type: "rect",
|
|
4567
4578
|
data: { id: "image.cropMask.right", zIndex: 4 },
|
|
4568
4579
|
props: {
|
|
4569
|
-
left:
|
|
4570
|
-
top:
|
|
4580
|
+
left: frameRight + rightW / 2,
|
|
4581
|
+
top: frameTop + visibleFrameH / 2,
|
|
4571
4582
|
width: rightW,
|
|
4572
|
-
height:
|
|
4583
|
+
height: visibleFrameH,
|
|
4573
4584
|
originX: "center",
|
|
4574
4585
|
originY: "center",
|
|
4575
4586
|
fill: visual.outerBackground,
|
|
@@ -4659,6 +4670,7 @@ var ImageTool = class {
|
|
|
4659
4670
|
if (this.isToolActive) {
|
|
4660
4671
|
this.updateImages();
|
|
4661
4672
|
}
|
|
4673
|
+
this.emitWorkingChange(id);
|
|
4662
4674
|
}
|
|
4663
4675
|
async updateImageInConfig(id, updates) {
|
|
4664
4676
|
var _a, _b, _c, _d;
|
|
@@ -4739,6 +4751,7 @@ var ImageTool = class {
|
|
|
4739
4751
|
this.isImageSelectionActive = true;
|
|
4740
4752
|
this.focusedImageId = id;
|
|
4741
4753
|
this.updateImages();
|
|
4754
|
+
this.emitWorkingChange(id);
|
|
4742
4755
|
}
|
|
4743
4756
|
focusImageSelection(id) {
|
|
4744
4757
|
if (!this.canvasService) return;
|
|
@@ -4831,6 +4844,7 @@ var ImageTool = class {
|
|
|
4831
4844
|
this.hasWorkingChanges = false;
|
|
4832
4845
|
this.workingItems = this.cloneItems(next);
|
|
4833
4846
|
this.updateConfig(next);
|
|
4847
|
+
this.emitWorkingChange(focusId);
|
|
4834
4848
|
if (focusId) {
|
|
4835
4849
|
this.focusedImageId = focusId;
|
|
4836
4850
|
this.isImageSelectionActive = true;
|
package/package.json
CHANGED
package/src/image.ts
CHANGED
|
@@ -148,10 +148,7 @@ export class ImageTool implements Extension {
|
|
|
148
148
|
context.eventBus.on("selection:created", this.onSelectionChanged);
|
|
149
149
|
context.eventBus.on("selection:updated", this.onSelectionChanged);
|
|
150
150
|
context.eventBus.on("selection:cleared", this.onSelectionCleared);
|
|
151
|
-
context.eventBus.on(
|
|
152
|
-
"scene:layout:change",
|
|
153
|
-
this.onSceneLayoutChanged,
|
|
154
|
-
);
|
|
151
|
+
context.eventBus.on("scene:layout:change", this.onSceneLayoutChanged);
|
|
155
152
|
|
|
156
153
|
const configService = context.services.get<ConfigurationService>(
|
|
157
154
|
"ConfigurationService",
|
|
@@ -198,10 +195,7 @@ export class ImageTool implements Extension {
|
|
|
198
195
|
context.eventBus.off("selection:created", this.onSelectionChanged);
|
|
199
196
|
context.eventBus.off("selection:updated", this.onSelectionChanged);
|
|
200
197
|
context.eventBus.off("selection:cleared", this.onSelectionCleared);
|
|
201
|
-
context.eventBus.off(
|
|
202
|
-
"scene:layout:change",
|
|
203
|
-
this.onSceneLayoutChanged,
|
|
204
|
-
);
|
|
198
|
+
context.eventBus.off("scene:layout:change", this.onSceneLayoutChanged);
|
|
205
199
|
this.dirtyTrackerDisposable?.dispose();
|
|
206
200
|
this.dirtyTrackerDisposable = undefined;
|
|
207
201
|
|
|
@@ -396,7 +390,7 @@ export class ImageTool implements Extension {
|
|
|
396
390
|
id: "image.frame.outerBackground",
|
|
397
391
|
type: "color",
|
|
398
392
|
label: "Image Frame Outer Background",
|
|
399
|
-
default: "
|
|
393
|
+
default: "#f5f5f5",
|
|
400
394
|
},
|
|
401
395
|
] as ConfigurationContribution[],
|
|
402
396
|
[ContributionPointIds.COMMANDS]: [
|
|
@@ -439,6 +433,7 @@ export class ImageTool implements Extension {
|
|
|
439
433
|
this.workingItems = this.cloneItems(this.items);
|
|
440
434
|
this.hasWorkingChanges = false;
|
|
441
435
|
this.updateImages();
|
|
436
|
+
this.emitWorkingChange();
|
|
442
437
|
},
|
|
443
438
|
},
|
|
444
439
|
{
|
|
@@ -578,6 +573,13 @@ export class ImageTool implements Extension {
|
|
|
578
573
|
return this.normalizeItems((items || []).map((i) => ({ ...i })));
|
|
579
574
|
}
|
|
580
575
|
|
|
576
|
+
private emitWorkingChange(changedId: string | null = null) {
|
|
577
|
+
this.context?.eventBus.emit("image:working:change", {
|
|
578
|
+
changedId,
|
|
579
|
+
items: this.cloneItems(this.workingItems),
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
581
583
|
private generateId(): string {
|
|
582
584
|
return Math.random().toString(36).substring(2, 9);
|
|
583
585
|
}
|
|
@@ -670,6 +672,7 @@ export class ImageTool implements Extension {
|
|
|
670
672
|
if (this.workingItems.some((existing) => existing.id === item.id)) return;
|
|
671
673
|
this.workingItems = this.cloneItems([...this.workingItems, item]);
|
|
672
674
|
this.updateImages();
|
|
675
|
+
this.emitWorkingChange(item.id);
|
|
673
676
|
}
|
|
674
677
|
|
|
675
678
|
private async updateImage(
|
|
@@ -893,11 +896,7 @@ export class ImageTool implements Extension {
|
|
|
893
896
|
"image.frame.innerBackground",
|
|
894
897
|
"rgba(0,0,0,0)",
|
|
895
898
|
) || "rgba(0,0,0,0)",
|
|
896
|
-
outerBackground:
|
|
897
|
-
this.getConfig<string>(
|
|
898
|
-
"image.frame.outerBackground",
|
|
899
|
-
"rgba(0,0,0,0.18)",
|
|
900
|
-
) || "rgba(0,0,0,0.18)",
|
|
899
|
+
outerBackground: "#f5f5f5",
|
|
901
900
|
};
|
|
902
901
|
}
|
|
903
902
|
|
|
@@ -1074,10 +1073,22 @@ export class ImageTool implements Extension {
|
|
|
1074
1073
|
const canvasH = this.canvasService.canvas.height || 0;
|
|
1075
1074
|
const visual = this.getFrameVisualConfig();
|
|
1076
1075
|
|
|
1077
|
-
const
|
|
1078
|
-
const
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1076
|
+
const frameLeft = Math.max(0, Math.min(canvasW, frame.left));
|
|
1077
|
+
const frameTop = Math.max(0, Math.min(canvasH, frame.top));
|
|
1078
|
+
const frameRight = Math.max(
|
|
1079
|
+
frameLeft,
|
|
1080
|
+
Math.min(canvasW, frame.left + frame.width),
|
|
1081
|
+
);
|
|
1082
|
+
const frameBottom = Math.max(
|
|
1083
|
+
frameTop,
|
|
1084
|
+
Math.min(canvasH, frame.top + frame.height),
|
|
1085
|
+
);
|
|
1086
|
+
const visibleFrameH = Math.max(0, frameBottom - frameTop);
|
|
1087
|
+
|
|
1088
|
+
const topH = frameTop;
|
|
1089
|
+
const bottomH = Math.max(0, canvasH - frameBottom);
|
|
1090
|
+
const leftW = frameLeft;
|
|
1091
|
+
const rightW = Math.max(0, canvasW - frameRight);
|
|
1081
1092
|
|
|
1082
1093
|
const mask: RenderObjectSpec[] = [
|
|
1083
1094
|
{
|
|
@@ -1102,7 +1113,7 @@ export class ImageTool implements Extension {
|
|
|
1102
1113
|
data: { id: "image.cropMask.bottom", zIndex: 2 },
|
|
1103
1114
|
props: {
|
|
1104
1115
|
left: canvasW / 2,
|
|
1105
|
-
top:
|
|
1116
|
+
top: frameBottom + bottomH / 2,
|
|
1106
1117
|
width: canvasW,
|
|
1107
1118
|
height: bottomH,
|
|
1108
1119
|
originX: "center",
|
|
@@ -1118,9 +1129,9 @@ export class ImageTool implements Extension {
|
|
|
1118
1129
|
data: { id: "image.cropMask.left", zIndex: 3 },
|
|
1119
1130
|
props: {
|
|
1120
1131
|
left: leftW / 2,
|
|
1121
|
-
top:
|
|
1132
|
+
top: frameTop + visibleFrameH / 2,
|
|
1122
1133
|
width: leftW,
|
|
1123
|
-
height:
|
|
1134
|
+
height: visibleFrameH,
|
|
1124
1135
|
originX: "center",
|
|
1125
1136
|
originY: "center",
|
|
1126
1137
|
fill: visual.outerBackground,
|
|
@@ -1133,10 +1144,10 @@ export class ImageTool implements Extension {
|
|
|
1133
1144
|
type: "rect",
|
|
1134
1145
|
data: { id: "image.cropMask.right", zIndex: 4 },
|
|
1135
1146
|
props: {
|
|
1136
|
-
left:
|
|
1137
|
-
top:
|
|
1147
|
+
left: frameRight + rightW / 2,
|
|
1148
|
+
top: frameTop + visibleFrameH / 2,
|
|
1138
1149
|
width: rightW,
|
|
1139
|
-
height:
|
|
1150
|
+
height: visibleFrameH,
|
|
1140
1151
|
originX: "center",
|
|
1141
1152
|
originY: "center",
|
|
1142
1153
|
fill: visual.outerBackground,
|
|
@@ -1275,6 +1286,7 @@ export class ImageTool implements Extension {
|
|
|
1275
1286
|
if (this.isToolActive) {
|
|
1276
1287
|
this.updateImages();
|
|
1277
1288
|
}
|
|
1289
|
+
this.emitWorkingChange(id);
|
|
1278
1290
|
}
|
|
1279
1291
|
|
|
1280
1292
|
private async updateImageInConfig(id: string, updates: Partial<ImageItem>) {
|
|
@@ -1371,6 +1383,7 @@ export class ImageTool implements Extension {
|
|
|
1371
1383
|
this.isImageSelectionActive = true;
|
|
1372
1384
|
this.focusedImageId = id;
|
|
1373
1385
|
this.updateImages();
|
|
1386
|
+
this.emitWorkingChange(id);
|
|
1374
1387
|
}
|
|
1375
1388
|
|
|
1376
1389
|
private focusImageSelection(id: string) {
|
|
@@ -1489,6 +1502,7 @@ export class ImageTool implements Extension {
|
|
|
1489
1502
|
this.hasWorkingChanges = false;
|
|
1490
1503
|
this.workingItems = this.cloneItems(next);
|
|
1491
1504
|
this.updateConfig(next);
|
|
1505
|
+
this.emitWorkingChange(focusId);
|
|
1492
1506
|
if (focusId) {
|
|
1493
1507
|
this.focusedImageId = focusId;
|
|
1494
1508
|
this.isImageSelectionActive = true;
|