microboard-temp 0.4.93 → 0.4.95
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/cjs/browser.js +14 -9
- package/dist/cjs/index.js +14 -9
- package/dist/cjs/node.js +14 -9
- package/dist/esm/browser.js +14 -9
- package/dist/esm/index.js +14 -9
- package/dist/esm/node.js +14 -9
- package/dist/types/Items/BaseItem/BaseItem.d.ts +1 -0
- package/dist/types/Items/Examples/CardGame/Card/Card.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -21474,6 +21474,7 @@ class BaseItem extends Mbr {
|
|
|
21474
21474
|
onRemoveCallbacks = [];
|
|
21475
21475
|
shouldUseCustomRender = false;
|
|
21476
21476
|
shouldRenderOutsideViewRect = true;
|
|
21477
|
+
shouldUseRelativeAlignment = true;
|
|
21477
21478
|
itemType = "";
|
|
21478
21479
|
constructor(board, id = "", defaultItemData, isGroupItem) {
|
|
21479
21480
|
super();
|
|
@@ -45714,10 +45715,10 @@ class AlignmentHelper {
|
|
|
45714
45715
|
}
|
|
45715
45716
|
};
|
|
45716
45717
|
nearbyItems.forEach((item) => {
|
|
45717
|
-
if (item === movingItem || item.itemType === "Comment") {
|
|
45718
|
+
if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
|
|
45718
45719
|
return;
|
|
45719
45720
|
}
|
|
45720
|
-
const itemMbr = item.
|
|
45721
|
+
const itemMbr = item.getPathMbr();
|
|
45721
45722
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
45722
45723
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
45723
45724
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -47835,7 +47836,7 @@ class Card extends BaseItem {
|
|
|
47835
47836
|
this.board.bringToFront(this);
|
|
47836
47837
|
}, 1000);
|
|
47837
47838
|
this.transformation.subject.subscribe((_, op) => {
|
|
47838
|
-
if (this.parent === "Board" && op.method === "translateBy"
|
|
47839
|
+
if (this.parent === "Board" && op.method === "translateBy") {
|
|
47839
47840
|
this.throttledBringToFront();
|
|
47840
47841
|
}
|
|
47841
47842
|
this.updateMbr();
|
|
@@ -47862,14 +47863,14 @@ class Card extends BaseItem {
|
|
|
47862
47863
|
this.imageToRender = this.face;
|
|
47863
47864
|
}
|
|
47864
47865
|
}
|
|
47865
|
-
render(context) {
|
|
47866
|
+
render(context, left) {
|
|
47866
47867
|
if (this.transformationRenderBlock) {
|
|
47867
47868
|
return;
|
|
47868
47869
|
}
|
|
47869
47870
|
const ctx = context.ctx;
|
|
47870
47871
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47871
47872
|
ctx.save();
|
|
47872
|
-
ctx.drawImage(this.imageToRender, this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47873
|
+
ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47873
47874
|
ctx.restore();
|
|
47874
47875
|
}
|
|
47875
47876
|
}
|
|
@@ -47956,6 +47957,7 @@ class Deck extends BaseItem {
|
|
|
47956
47957
|
});
|
|
47957
47958
|
this.board.items.index.remove(foundItem);
|
|
47958
47959
|
foundItem.parent = this.getId();
|
|
47960
|
+
foundItem.shouldUseRelativeAlignment = false;
|
|
47959
47961
|
this.index?.insert(foundItem);
|
|
47960
47962
|
}
|
|
47961
47963
|
}
|
|
@@ -47980,6 +47982,7 @@ class Deck extends BaseItem {
|
|
|
47980
47982
|
});
|
|
47981
47983
|
this.index?.remove(foundItem);
|
|
47982
47984
|
foundItem.parent = "Board";
|
|
47985
|
+
foundItem.shouldUseRelativeAlignment = true;
|
|
47983
47986
|
this.board.items.index.insert(foundItem);
|
|
47984
47987
|
}
|
|
47985
47988
|
}
|
|
@@ -48066,14 +48069,16 @@ class Deck extends BaseItem {
|
|
|
48066
48069
|
if (!width2 || !height3) {
|
|
48067
48070
|
return;
|
|
48068
48071
|
}
|
|
48069
|
-
const tempCanvas =
|
|
48070
|
-
tempCanvas.width =
|
|
48071
|
-
tempCanvas.height =
|
|
48072
|
+
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
48073
|
+
tempCanvas.width = 1e4;
|
|
48074
|
+
tempCanvas.height = 1e4;
|
|
48072
48075
|
const tempCtx = tempCanvas.getContext("2d");
|
|
48073
48076
|
if (!tempCtx)
|
|
48074
48077
|
return;
|
|
48075
48078
|
const tempContext = { ...context, ctx: tempCtx };
|
|
48076
|
-
this.index?.
|
|
48079
|
+
this.index?.list().forEach((item, index2) => {
|
|
48080
|
+
item.render(tempContext, index2 * 2);
|
|
48081
|
+
});
|
|
48077
48082
|
this.cachedCanvas = tempCanvas;
|
|
48078
48083
|
}
|
|
48079
48084
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -21474,6 +21474,7 @@ class BaseItem extends Mbr {
|
|
|
21474
21474
|
onRemoveCallbacks = [];
|
|
21475
21475
|
shouldUseCustomRender = false;
|
|
21476
21476
|
shouldRenderOutsideViewRect = true;
|
|
21477
|
+
shouldUseRelativeAlignment = true;
|
|
21477
21478
|
itemType = "";
|
|
21478
21479
|
constructor(board, id = "", defaultItemData, isGroupItem) {
|
|
21479
21480
|
super();
|
|
@@ -45714,10 +45715,10 @@ class AlignmentHelper {
|
|
|
45714
45715
|
}
|
|
45715
45716
|
};
|
|
45716
45717
|
nearbyItems.forEach((item) => {
|
|
45717
|
-
if (item === movingItem || item.itemType === "Comment") {
|
|
45718
|
+
if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
|
|
45718
45719
|
return;
|
|
45719
45720
|
}
|
|
45720
|
-
const itemMbr = item.
|
|
45721
|
+
const itemMbr = item.getPathMbr();
|
|
45721
45722
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
45722
45723
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
45723
45724
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -47835,7 +47836,7 @@ class Card extends BaseItem {
|
|
|
47835
47836
|
this.board.bringToFront(this);
|
|
47836
47837
|
}, 1000);
|
|
47837
47838
|
this.transformation.subject.subscribe((_, op) => {
|
|
47838
|
-
if (this.parent === "Board" && op.method === "translateBy"
|
|
47839
|
+
if (this.parent === "Board" && op.method === "translateBy") {
|
|
47839
47840
|
this.throttledBringToFront();
|
|
47840
47841
|
}
|
|
47841
47842
|
this.updateMbr();
|
|
@@ -47862,14 +47863,14 @@ class Card extends BaseItem {
|
|
|
47862
47863
|
this.imageToRender = this.face;
|
|
47863
47864
|
}
|
|
47864
47865
|
}
|
|
47865
|
-
render(context) {
|
|
47866
|
+
render(context, left) {
|
|
47866
47867
|
if (this.transformationRenderBlock) {
|
|
47867
47868
|
return;
|
|
47868
47869
|
}
|
|
47869
47870
|
const ctx = context.ctx;
|
|
47870
47871
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47871
47872
|
ctx.save();
|
|
47872
|
-
ctx.drawImage(this.imageToRender, this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47873
|
+
ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47873
47874
|
ctx.restore();
|
|
47874
47875
|
}
|
|
47875
47876
|
}
|
|
@@ -47956,6 +47957,7 @@ class Deck extends BaseItem {
|
|
|
47956
47957
|
});
|
|
47957
47958
|
this.board.items.index.remove(foundItem);
|
|
47958
47959
|
foundItem.parent = this.getId();
|
|
47960
|
+
foundItem.shouldUseRelativeAlignment = false;
|
|
47959
47961
|
this.index?.insert(foundItem);
|
|
47960
47962
|
}
|
|
47961
47963
|
}
|
|
@@ -47980,6 +47982,7 @@ class Deck extends BaseItem {
|
|
|
47980
47982
|
});
|
|
47981
47983
|
this.index?.remove(foundItem);
|
|
47982
47984
|
foundItem.parent = "Board";
|
|
47985
|
+
foundItem.shouldUseRelativeAlignment = true;
|
|
47983
47986
|
this.board.items.index.insert(foundItem);
|
|
47984
47987
|
}
|
|
47985
47988
|
}
|
|
@@ -48066,14 +48069,16 @@ class Deck extends BaseItem {
|
|
|
48066
48069
|
if (!width2 || !height3) {
|
|
48067
48070
|
return;
|
|
48068
48071
|
}
|
|
48069
|
-
const tempCanvas =
|
|
48070
|
-
tempCanvas.width =
|
|
48071
|
-
tempCanvas.height =
|
|
48072
|
+
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
48073
|
+
tempCanvas.width = 1e4;
|
|
48074
|
+
tempCanvas.height = 1e4;
|
|
48072
48075
|
const tempCtx = tempCanvas.getContext("2d");
|
|
48073
48076
|
if (!tempCtx)
|
|
48074
48077
|
return;
|
|
48075
48078
|
const tempContext = { ...context, ctx: tempCtx };
|
|
48076
|
-
this.index?.
|
|
48079
|
+
this.index?.list().forEach((item, index2) => {
|
|
48080
|
+
item.render(tempContext, index2 * 2);
|
|
48081
|
+
});
|
|
48077
48082
|
this.cachedCanvas = tempCanvas;
|
|
48078
48083
|
}
|
|
48079
48084
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -23946,6 +23946,7 @@ class BaseItem extends Mbr {
|
|
|
23946
23946
|
onRemoveCallbacks = [];
|
|
23947
23947
|
shouldUseCustomRender = false;
|
|
23948
23948
|
shouldRenderOutsideViewRect = true;
|
|
23949
|
+
shouldUseRelativeAlignment = true;
|
|
23949
23950
|
itemType = "";
|
|
23950
23951
|
constructor(board, id = "", defaultItemData, isGroupItem) {
|
|
23951
23952
|
super();
|
|
@@ -48187,10 +48188,10 @@ class AlignmentHelper {
|
|
|
48187
48188
|
}
|
|
48188
48189
|
};
|
|
48189
48190
|
nearbyItems.forEach((item) => {
|
|
48190
|
-
if (item === movingItem || item.itemType === "Comment") {
|
|
48191
|
+
if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
|
|
48191
48192
|
return;
|
|
48192
48193
|
}
|
|
48193
|
-
const itemMbr = item.
|
|
48194
|
+
const itemMbr = item.getPathMbr();
|
|
48194
48195
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
48195
48196
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
48196
48197
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -50308,7 +50309,7 @@ class Card extends BaseItem {
|
|
|
50308
50309
|
this.board.bringToFront(this);
|
|
50309
50310
|
}, 1000);
|
|
50310
50311
|
this.transformation.subject.subscribe((_, op) => {
|
|
50311
|
-
if (this.parent === "Board" && op.method === "translateBy"
|
|
50312
|
+
if (this.parent === "Board" && op.method === "translateBy") {
|
|
50312
50313
|
this.throttledBringToFront();
|
|
50313
50314
|
}
|
|
50314
50315
|
this.updateMbr();
|
|
@@ -50335,14 +50336,14 @@ class Card extends BaseItem {
|
|
|
50335
50336
|
this.imageToRender = this.face;
|
|
50336
50337
|
}
|
|
50337
50338
|
}
|
|
50338
|
-
render(context) {
|
|
50339
|
+
render(context, left) {
|
|
50339
50340
|
if (this.transformationRenderBlock) {
|
|
50340
50341
|
return;
|
|
50341
50342
|
}
|
|
50342
50343
|
const ctx = context.ctx;
|
|
50343
50344
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
50344
50345
|
ctx.save();
|
|
50345
|
-
ctx.drawImage(this.imageToRender, this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
50346
|
+
ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
50346
50347
|
ctx.restore();
|
|
50347
50348
|
}
|
|
50348
50349
|
}
|
|
@@ -50429,6 +50430,7 @@ class Deck extends BaseItem {
|
|
|
50429
50430
|
});
|
|
50430
50431
|
this.board.items.index.remove(foundItem);
|
|
50431
50432
|
foundItem.parent = this.getId();
|
|
50433
|
+
foundItem.shouldUseRelativeAlignment = false;
|
|
50432
50434
|
this.index?.insert(foundItem);
|
|
50433
50435
|
}
|
|
50434
50436
|
}
|
|
@@ -50453,6 +50455,7 @@ class Deck extends BaseItem {
|
|
|
50453
50455
|
});
|
|
50454
50456
|
this.index?.remove(foundItem);
|
|
50455
50457
|
foundItem.parent = "Board";
|
|
50458
|
+
foundItem.shouldUseRelativeAlignment = true;
|
|
50456
50459
|
this.board.items.index.insert(foundItem);
|
|
50457
50460
|
}
|
|
50458
50461
|
}
|
|
@@ -50539,14 +50542,16 @@ class Deck extends BaseItem {
|
|
|
50539
50542
|
if (!width2 || !height3) {
|
|
50540
50543
|
return;
|
|
50541
50544
|
}
|
|
50542
|
-
const tempCanvas =
|
|
50543
|
-
tempCanvas.width =
|
|
50544
|
-
tempCanvas.height =
|
|
50545
|
+
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
50546
|
+
tempCanvas.width = 1e4;
|
|
50547
|
+
tempCanvas.height = 1e4;
|
|
50545
50548
|
const tempCtx = tempCanvas.getContext("2d");
|
|
50546
50549
|
if (!tempCtx)
|
|
50547
50550
|
return;
|
|
50548
50551
|
const tempContext = { ...context, ctx: tempCtx };
|
|
50549
|
-
this.index?.
|
|
50552
|
+
this.index?.list().forEach((item, index2) => {
|
|
50553
|
+
item.render(tempContext, index2 * 2);
|
|
50554
|
+
});
|
|
50550
50555
|
this.cachedCanvas = tempCanvas;
|
|
50551
50556
|
}
|
|
50552
50557
|
}
|
package/dist/esm/browser.js
CHANGED
|
@@ -21323,6 +21323,7 @@ class BaseItem extends Mbr {
|
|
|
21323
21323
|
onRemoveCallbacks = [];
|
|
21324
21324
|
shouldUseCustomRender = false;
|
|
21325
21325
|
shouldRenderOutsideViewRect = true;
|
|
21326
|
+
shouldUseRelativeAlignment = true;
|
|
21326
21327
|
itemType = "";
|
|
21327
21328
|
constructor(board, id = "", defaultItemData, isGroupItem) {
|
|
21328
21329
|
super();
|
|
@@ -45563,10 +45564,10 @@ class AlignmentHelper {
|
|
|
45563
45564
|
}
|
|
45564
45565
|
};
|
|
45565
45566
|
nearbyItems.forEach((item) => {
|
|
45566
|
-
if (item === movingItem || item.itemType === "Comment") {
|
|
45567
|
+
if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
|
|
45567
45568
|
return;
|
|
45568
45569
|
}
|
|
45569
|
-
const itemMbr = item.
|
|
45570
|
+
const itemMbr = item.getPathMbr();
|
|
45570
45571
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
45571
45572
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
45572
45573
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -47684,7 +47685,7 @@ class Card extends BaseItem {
|
|
|
47684
47685
|
this.board.bringToFront(this);
|
|
47685
47686
|
}, 1000);
|
|
47686
47687
|
this.transformation.subject.subscribe((_, op) => {
|
|
47687
|
-
if (this.parent === "Board" && op.method === "translateBy"
|
|
47688
|
+
if (this.parent === "Board" && op.method === "translateBy") {
|
|
47688
47689
|
this.throttledBringToFront();
|
|
47689
47690
|
}
|
|
47690
47691
|
this.updateMbr();
|
|
@@ -47711,14 +47712,14 @@ class Card extends BaseItem {
|
|
|
47711
47712
|
this.imageToRender = this.face;
|
|
47712
47713
|
}
|
|
47713
47714
|
}
|
|
47714
|
-
render(context) {
|
|
47715
|
+
render(context, left) {
|
|
47715
47716
|
if (this.transformationRenderBlock) {
|
|
47716
47717
|
return;
|
|
47717
47718
|
}
|
|
47718
47719
|
const ctx = context.ctx;
|
|
47719
47720
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47720
47721
|
ctx.save();
|
|
47721
|
-
ctx.drawImage(this.imageToRender, this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47722
|
+
ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47722
47723
|
ctx.restore();
|
|
47723
47724
|
}
|
|
47724
47725
|
}
|
|
@@ -47805,6 +47806,7 @@ class Deck extends BaseItem {
|
|
|
47805
47806
|
});
|
|
47806
47807
|
this.board.items.index.remove(foundItem);
|
|
47807
47808
|
foundItem.parent = this.getId();
|
|
47809
|
+
foundItem.shouldUseRelativeAlignment = false;
|
|
47808
47810
|
this.index?.insert(foundItem);
|
|
47809
47811
|
}
|
|
47810
47812
|
}
|
|
@@ -47829,6 +47831,7 @@ class Deck extends BaseItem {
|
|
|
47829
47831
|
});
|
|
47830
47832
|
this.index?.remove(foundItem);
|
|
47831
47833
|
foundItem.parent = "Board";
|
|
47834
|
+
foundItem.shouldUseRelativeAlignment = true;
|
|
47832
47835
|
this.board.items.index.insert(foundItem);
|
|
47833
47836
|
}
|
|
47834
47837
|
}
|
|
@@ -47915,14 +47918,16 @@ class Deck extends BaseItem {
|
|
|
47915
47918
|
if (!width2 || !height3) {
|
|
47916
47919
|
return;
|
|
47917
47920
|
}
|
|
47918
|
-
const tempCanvas =
|
|
47919
|
-
tempCanvas.width =
|
|
47920
|
-
tempCanvas.height =
|
|
47921
|
+
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
47922
|
+
tempCanvas.width = 1e4;
|
|
47923
|
+
tempCanvas.height = 1e4;
|
|
47921
47924
|
const tempCtx = tempCanvas.getContext("2d");
|
|
47922
47925
|
if (!tempCtx)
|
|
47923
47926
|
return;
|
|
47924
47927
|
const tempContext = { ...context, ctx: tempCtx };
|
|
47925
|
-
this.index?.
|
|
47928
|
+
this.index?.list().forEach((item, index2) => {
|
|
47929
|
+
item.render(tempContext, index2 * 2);
|
|
47930
|
+
});
|
|
47926
47931
|
this.cachedCanvas = tempCanvas;
|
|
47927
47932
|
}
|
|
47928
47933
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -21316,6 +21316,7 @@ class BaseItem extends Mbr {
|
|
|
21316
21316
|
onRemoveCallbacks = [];
|
|
21317
21317
|
shouldUseCustomRender = false;
|
|
21318
21318
|
shouldRenderOutsideViewRect = true;
|
|
21319
|
+
shouldUseRelativeAlignment = true;
|
|
21319
21320
|
itemType = "";
|
|
21320
21321
|
constructor(board, id = "", defaultItemData, isGroupItem) {
|
|
21321
21322
|
super();
|
|
@@ -45556,10 +45557,10 @@ class AlignmentHelper {
|
|
|
45556
45557
|
}
|
|
45557
45558
|
};
|
|
45558
45559
|
nearbyItems.forEach((item) => {
|
|
45559
|
-
if (item === movingItem || item.itemType === "Comment") {
|
|
45560
|
+
if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
|
|
45560
45561
|
return;
|
|
45561
45562
|
}
|
|
45562
|
-
const itemMbr = item.
|
|
45563
|
+
const itemMbr = item.getPathMbr();
|
|
45563
45564
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
45564
45565
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
45565
45566
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -47677,7 +47678,7 @@ class Card extends BaseItem {
|
|
|
47677
47678
|
this.board.bringToFront(this);
|
|
47678
47679
|
}, 1000);
|
|
47679
47680
|
this.transformation.subject.subscribe((_, op) => {
|
|
47680
|
-
if (this.parent === "Board" && op.method === "translateBy"
|
|
47681
|
+
if (this.parent === "Board" && op.method === "translateBy") {
|
|
47681
47682
|
this.throttledBringToFront();
|
|
47682
47683
|
}
|
|
47683
47684
|
this.updateMbr();
|
|
@@ -47704,14 +47705,14 @@ class Card extends BaseItem {
|
|
|
47704
47705
|
this.imageToRender = this.face;
|
|
47705
47706
|
}
|
|
47706
47707
|
}
|
|
47707
|
-
render(context) {
|
|
47708
|
+
render(context, left) {
|
|
47708
47709
|
if (this.transformationRenderBlock) {
|
|
47709
47710
|
return;
|
|
47710
47711
|
}
|
|
47711
47712
|
const ctx = context.ctx;
|
|
47712
47713
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
47713
47714
|
ctx.save();
|
|
47714
|
-
ctx.drawImage(this.imageToRender, this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47715
|
+
ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
47715
47716
|
ctx.restore();
|
|
47716
47717
|
}
|
|
47717
47718
|
}
|
|
@@ -47798,6 +47799,7 @@ class Deck extends BaseItem {
|
|
|
47798
47799
|
});
|
|
47799
47800
|
this.board.items.index.remove(foundItem);
|
|
47800
47801
|
foundItem.parent = this.getId();
|
|
47802
|
+
foundItem.shouldUseRelativeAlignment = false;
|
|
47801
47803
|
this.index?.insert(foundItem);
|
|
47802
47804
|
}
|
|
47803
47805
|
}
|
|
@@ -47822,6 +47824,7 @@ class Deck extends BaseItem {
|
|
|
47822
47824
|
});
|
|
47823
47825
|
this.index?.remove(foundItem);
|
|
47824
47826
|
foundItem.parent = "Board";
|
|
47827
|
+
foundItem.shouldUseRelativeAlignment = true;
|
|
47825
47828
|
this.board.items.index.insert(foundItem);
|
|
47826
47829
|
}
|
|
47827
47830
|
}
|
|
@@ -47908,14 +47911,16 @@ class Deck extends BaseItem {
|
|
|
47908
47911
|
if (!width2 || !height3) {
|
|
47909
47912
|
return;
|
|
47910
47913
|
}
|
|
47911
|
-
const tempCanvas =
|
|
47912
|
-
tempCanvas.width =
|
|
47913
|
-
tempCanvas.height =
|
|
47914
|
+
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
47915
|
+
tempCanvas.width = 1e4;
|
|
47916
|
+
tempCanvas.height = 1e4;
|
|
47914
47917
|
const tempCtx = tempCanvas.getContext("2d");
|
|
47915
47918
|
if (!tempCtx)
|
|
47916
47919
|
return;
|
|
47917
47920
|
const tempContext = { ...context, ctx: tempCtx };
|
|
47918
|
-
this.index?.
|
|
47921
|
+
this.index?.list().forEach((item, index2) => {
|
|
47922
|
+
item.render(tempContext, index2 * 2);
|
|
47923
|
+
});
|
|
47919
47924
|
this.cachedCanvas = tempCanvas;
|
|
47920
47925
|
}
|
|
47921
47926
|
}
|
package/dist/esm/node.js
CHANGED
|
@@ -23783,6 +23783,7 @@ class BaseItem extends Mbr {
|
|
|
23783
23783
|
onRemoveCallbacks = [];
|
|
23784
23784
|
shouldUseCustomRender = false;
|
|
23785
23785
|
shouldRenderOutsideViewRect = true;
|
|
23786
|
+
shouldUseRelativeAlignment = true;
|
|
23786
23787
|
itemType = "";
|
|
23787
23788
|
constructor(board, id = "", defaultItemData, isGroupItem) {
|
|
23788
23789
|
super();
|
|
@@ -48024,10 +48025,10 @@ class AlignmentHelper {
|
|
|
48024
48025
|
}
|
|
48025
48026
|
};
|
|
48026
48027
|
nearbyItems.forEach((item) => {
|
|
48027
|
-
if (item === movingItem || item.itemType === "Comment") {
|
|
48028
|
+
if (item === movingItem || item.itemType === "Comment" || item instanceof BaseItem && !item.shouldUseRelativeAlignment) {
|
|
48028
48029
|
return;
|
|
48029
48030
|
}
|
|
48030
|
-
const itemMbr = item.
|
|
48031
|
+
const itemMbr = item.getPathMbr();
|
|
48031
48032
|
const centerXMoving = (movingMBR.left + movingMBR.right) / 2;
|
|
48032
48033
|
const centerXItem = (itemMbr.left + itemMbr.right) / 2;
|
|
48033
48034
|
const centerYMoving = (movingMBR.top + movingMBR.bottom) / 2;
|
|
@@ -50145,7 +50146,7 @@ class Card extends BaseItem {
|
|
|
50145
50146
|
this.board.bringToFront(this);
|
|
50146
50147
|
}, 1000);
|
|
50147
50148
|
this.transformation.subject.subscribe((_, op) => {
|
|
50148
|
-
if (this.parent === "Board" && op.method === "translateBy"
|
|
50149
|
+
if (this.parent === "Board" && op.method === "translateBy") {
|
|
50149
50150
|
this.throttledBringToFront();
|
|
50150
50151
|
}
|
|
50151
50152
|
this.updateMbr();
|
|
@@ -50172,14 +50173,14 @@ class Card extends BaseItem {
|
|
|
50172
50173
|
this.imageToRender = this.face;
|
|
50173
50174
|
}
|
|
50174
50175
|
}
|
|
50175
|
-
render(context) {
|
|
50176
|
+
render(context, left) {
|
|
50176
50177
|
if (this.transformationRenderBlock) {
|
|
50177
50178
|
return;
|
|
50178
50179
|
}
|
|
50179
50180
|
const ctx = context.ctx;
|
|
50180
50181
|
if (this.imageToRender && this.imageToRender.complete) {
|
|
50181
50182
|
ctx.save();
|
|
50182
|
-
ctx.drawImage(this.imageToRender, this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
50183
|
+
ctx.drawImage(this.imageToRender, left ? left : this.left, this.top, CARD_DIMENSIONS.width, CARD_DIMENSIONS.height);
|
|
50183
50184
|
ctx.restore();
|
|
50184
50185
|
}
|
|
50185
50186
|
}
|
|
@@ -50266,6 +50267,7 @@ class Deck extends BaseItem {
|
|
|
50266
50267
|
});
|
|
50267
50268
|
this.board.items.index.remove(foundItem);
|
|
50268
50269
|
foundItem.parent = this.getId();
|
|
50270
|
+
foundItem.shouldUseRelativeAlignment = false;
|
|
50269
50271
|
this.index?.insert(foundItem);
|
|
50270
50272
|
}
|
|
50271
50273
|
}
|
|
@@ -50290,6 +50292,7 @@ class Deck extends BaseItem {
|
|
|
50290
50292
|
});
|
|
50291
50293
|
this.index?.remove(foundItem);
|
|
50292
50294
|
foundItem.parent = "Board";
|
|
50295
|
+
foundItem.shouldUseRelativeAlignment = true;
|
|
50293
50296
|
this.board.items.index.insert(foundItem);
|
|
50294
50297
|
}
|
|
50295
50298
|
}
|
|
@@ -50376,14 +50379,16 @@ class Deck extends BaseItem {
|
|
|
50376
50379
|
if (!width2 || !height3) {
|
|
50377
50380
|
return;
|
|
50378
50381
|
}
|
|
50379
|
-
const tempCanvas =
|
|
50380
|
-
tempCanvas.width =
|
|
50381
|
-
tempCanvas.height =
|
|
50382
|
+
const tempCanvas = conf.documentFactory.createElement("canvas");
|
|
50383
|
+
tempCanvas.width = 1e4;
|
|
50384
|
+
tempCanvas.height = 1e4;
|
|
50382
50385
|
const tempCtx = tempCanvas.getContext("2d");
|
|
50383
50386
|
if (!tempCtx)
|
|
50384
50387
|
return;
|
|
50385
50388
|
const tempContext = { ...context, ctx: tempCtx };
|
|
50386
|
-
this.index?.
|
|
50389
|
+
this.index?.list().forEach((item, index2) => {
|
|
50390
|
+
item.render(tempContext, index2 * 2);
|
|
50391
|
+
});
|
|
50387
50392
|
this.cachedCanvas = tempCanvas;
|
|
50388
50393
|
}
|
|
50389
50394
|
}
|
|
@@ -36,6 +36,7 @@ export declare class BaseItem extends Mbr implements Geometry {
|
|
|
36
36
|
onRemoveCallbacks: (() => void)[];
|
|
37
37
|
shouldUseCustomRender: boolean;
|
|
38
38
|
shouldRenderOutsideViewRect: boolean;
|
|
39
|
+
shouldUseRelativeAlignment: boolean;
|
|
39
40
|
itemType: string;
|
|
40
41
|
constructor(board: Board, id?: string, defaultItemData?: BaseItemData | undefined, isGroupItem?: boolean);
|
|
41
42
|
getId(): string;
|
|
@@ -26,7 +26,7 @@ export declare class Card extends BaseItem {
|
|
|
26
26
|
});
|
|
27
27
|
createImages(): void;
|
|
28
28
|
updateImageToRender(): void;
|
|
29
|
-
render(context: DrawingContext): void;
|
|
29
|
+
render(context: DrawingContext, left?: number): void;
|
|
30
30
|
updateMbr(): void;
|
|
31
31
|
getPath(): Path | Paths;
|
|
32
32
|
deserialize(data: SerializedItemData): this;
|