microboard-temp 0.5.26 → 0.5.28
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 +23 -6
- package/dist/cjs/index.js +23 -6
- package/dist/cjs/node.js +23 -6
- package/dist/esm/browser.js +23 -6
- package/dist/esm/index.js +23 -6
- package/dist/esm/node.js +23 -6
- package/dist/types/Events/MessageRouter/handleBoardSubscriptionCompletedMsg.d.ts +2 -2
- package/dist/types/Items/Examples/CardGame/Card/Card.d.ts +1 -0
- package/dist/types/Items/Examples/CardGame/Deck/Deck.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -7069,7 +7069,7 @@ var conf = {
|
|
|
7069
7069
|
FALLBACK_LNG: "en",
|
|
7070
7070
|
cursorsMap,
|
|
7071
7071
|
DECK_HORIZONTAL_OFFSET: 2,
|
|
7072
|
-
DECK_VERTICAL_OFFSET:
|
|
7072
|
+
DECK_VERTICAL_OFFSET: 2,
|
|
7073
7073
|
CARD_DIMENSIONS: { width: 250, height: 400 }
|
|
7074
7074
|
};
|
|
7075
7075
|
initDefaultI18N();
|
|
@@ -42229,6 +42229,14 @@ class ImageItem extends BaseItem {
|
|
|
42229
42229
|
const ctx = context.ctx;
|
|
42230
42230
|
ctx.save();
|
|
42231
42231
|
this.transformation.matrix.applyToContext(ctx);
|
|
42232
|
+
const rotation = this.transformation.getRotation();
|
|
42233
|
+
if (rotation !== 0) {
|
|
42234
|
+
const imgWidth = this.image.width || 0;
|
|
42235
|
+
const imgHeight = this.image.height || 0;
|
|
42236
|
+
ctx.translate(imgWidth / 2, imgHeight / 2);
|
|
42237
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
42238
|
+
ctx.translate(-imgWidth / 2, -imgHeight / 2);
|
|
42239
|
+
}
|
|
42232
42240
|
ctx.drawImage(this.image, 0, 0);
|
|
42233
42241
|
ctx.restore();
|
|
42234
42242
|
if (this.getLinkTo()) {
|
|
@@ -47874,6 +47882,9 @@ class Card extends BaseItem {
|
|
|
47874
47882
|
getImage() {
|
|
47875
47883
|
return this.imageToRender;
|
|
47876
47884
|
}
|
|
47885
|
+
getIsRotatedPerpendicular() {
|
|
47886
|
+
return Boolean(this.transformation.getRotation() % 180);
|
|
47887
|
+
}
|
|
47877
47888
|
render(context, left, top) {
|
|
47878
47889
|
if (this.transformationRenderBlock) {
|
|
47879
47890
|
return;
|
|
@@ -47886,7 +47897,7 @@ class Card extends BaseItem {
|
|
|
47886
47897
|
const height3 = this.getHeight();
|
|
47887
47898
|
if (typeof left === "number" && typeof top === "number") {
|
|
47888
47899
|
centerX = left + width2 / 2;
|
|
47889
|
-
|
|
47900
|
+
centerY = top + height3 / 2;
|
|
47890
47901
|
}
|
|
47891
47902
|
ctx.translate(centerX, centerY);
|
|
47892
47903
|
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
@@ -48014,6 +48025,7 @@ class Deck extends BaseItem {
|
|
|
48014
48025
|
isCacheDirty = true;
|
|
48015
48026
|
enableResize = false;
|
|
48016
48027
|
path = null;
|
|
48028
|
+
isPerpendicular = undefined;
|
|
48017
48029
|
constructor(board, id = "") {
|
|
48018
48030
|
super(board, id, defaultDeckData, true);
|
|
48019
48031
|
this.index.getUnderPoint = () => [];
|
|
@@ -48025,6 +48037,9 @@ class Deck extends BaseItem {
|
|
|
48025
48037
|
});
|
|
48026
48038
|
this.updateMbr();
|
|
48027
48039
|
}
|
|
48040
|
+
getIsPerpendicular() {
|
|
48041
|
+
return this.isPerpendicular;
|
|
48042
|
+
}
|
|
48028
48043
|
applyAddChildren(childIds) {
|
|
48029
48044
|
if (!this.index) {
|
|
48030
48045
|
return;
|
|
@@ -48032,13 +48047,15 @@ class Deck extends BaseItem {
|
|
|
48032
48047
|
childIds.forEach((childId) => {
|
|
48033
48048
|
const foundItem = this.board.items.getById(childId);
|
|
48034
48049
|
if (this.parent !== childId && this.getId() !== childId) {
|
|
48035
|
-
|
|
48050
|
+
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
|
|
48051
|
+
if (canAddItem) {
|
|
48052
|
+
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
48036
48053
|
foundItem.transformation.apply({
|
|
48037
48054
|
class: "Transformation",
|
|
48038
48055
|
method: "translateTo",
|
|
48039
48056
|
item: [this.id],
|
|
48040
|
-
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
48041
|
-
y: this.top
|
|
48057
|
+
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
48058
|
+
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
48042
48059
|
});
|
|
48043
48060
|
this.board.items.index.remove(foundItem);
|
|
48044
48061
|
foundItem.parent = this.getId();
|
|
@@ -56544,11 +56561,11 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
56544
56561
|
}
|
|
56545
56562
|
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
56546
56563
|
board.setInterfaceType(msg.mode);
|
|
56564
|
+
board.subject.publish();
|
|
56547
56565
|
onBoardLoad(board);
|
|
56548
56566
|
}
|
|
56549
56567
|
function handleSeqNumApplication(initialSequenceNumber, board) {
|
|
56550
56568
|
const { log } = board.events;
|
|
56551
|
-
console.log(`upd seq number from ${log.currentSequenceNumber.toString()} to ${initialSequenceNumber}`);
|
|
56552
56569
|
log.currentSequenceNumber = initialSequenceNumber;
|
|
56553
56570
|
if (log.pendingEvent) {
|
|
56554
56571
|
log.pendingEvent.sequenceNumber = log.currentSequenceNumber;
|
package/dist/cjs/index.js
CHANGED
|
@@ -7069,7 +7069,7 @@ var conf = {
|
|
|
7069
7069
|
FALLBACK_LNG: "en",
|
|
7070
7070
|
cursorsMap,
|
|
7071
7071
|
DECK_HORIZONTAL_OFFSET: 2,
|
|
7072
|
-
DECK_VERTICAL_OFFSET:
|
|
7072
|
+
DECK_VERTICAL_OFFSET: 2,
|
|
7073
7073
|
CARD_DIMENSIONS: { width: 250, height: 400 }
|
|
7074
7074
|
};
|
|
7075
7075
|
initDefaultI18N();
|
|
@@ -42229,6 +42229,14 @@ class ImageItem extends BaseItem {
|
|
|
42229
42229
|
const ctx = context.ctx;
|
|
42230
42230
|
ctx.save();
|
|
42231
42231
|
this.transformation.matrix.applyToContext(ctx);
|
|
42232
|
+
const rotation = this.transformation.getRotation();
|
|
42233
|
+
if (rotation !== 0) {
|
|
42234
|
+
const imgWidth = this.image.width || 0;
|
|
42235
|
+
const imgHeight = this.image.height || 0;
|
|
42236
|
+
ctx.translate(imgWidth / 2, imgHeight / 2);
|
|
42237
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
42238
|
+
ctx.translate(-imgWidth / 2, -imgHeight / 2);
|
|
42239
|
+
}
|
|
42232
42240
|
ctx.drawImage(this.image, 0, 0);
|
|
42233
42241
|
ctx.restore();
|
|
42234
42242
|
if (this.getLinkTo()) {
|
|
@@ -47874,6 +47882,9 @@ class Card extends BaseItem {
|
|
|
47874
47882
|
getImage() {
|
|
47875
47883
|
return this.imageToRender;
|
|
47876
47884
|
}
|
|
47885
|
+
getIsRotatedPerpendicular() {
|
|
47886
|
+
return Boolean(this.transformation.getRotation() % 180);
|
|
47887
|
+
}
|
|
47877
47888
|
render(context, left, top) {
|
|
47878
47889
|
if (this.transformationRenderBlock) {
|
|
47879
47890
|
return;
|
|
@@ -47886,7 +47897,7 @@ class Card extends BaseItem {
|
|
|
47886
47897
|
const height3 = this.getHeight();
|
|
47887
47898
|
if (typeof left === "number" && typeof top === "number") {
|
|
47888
47899
|
centerX = left + width2 / 2;
|
|
47889
|
-
|
|
47900
|
+
centerY = top + height3 / 2;
|
|
47890
47901
|
}
|
|
47891
47902
|
ctx.translate(centerX, centerY);
|
|
47892
47903
|
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
@@ -48014,6 +48025,7 @@ class Deck extends BaseItem {
|
|
|
48014
48025
|
isCacheDirty = true;
|
|
48015
48026
|
enableResize = false;
|
|
48016
48027
|
path = null;
|
|
48028
|
+
isPerpendicular = undefined;
|
|
48017
48029
|
constructor(board, id = "") {
|
|
48018
48030
|
super(board, id, defaultDeckData, true);
|
|
48019
48031
|
this.index.getUnderPoint = () => [];
|
|
@@ -48025,6 +48037,9 @@ class Deck extends BaseItem {
|
|
|
48025
48037
|
});
|
|
48026
48038
|
this.updateMbr();
|
|
48027
48039
|
}
|
|
48040
|
+
getIsPerpendicular() {
|
|
48041
|
+
return this.isPerpendicular;
|
|
48042
|
+
}
|
|
48028
48043
|
applyAddChildren(childIds) {
|
|
48029
48044
|
if (!this.index) {
|
|
48030
48045
|
return;
|
|
@@ -48032,13 +48047,15 @@ class Deck extends BaseItem {
|
|
|
48032
48047
|
childIds.forEach((childId) => {
|
|
48033
48048
|
const foundItem = this.board.items.getById(childId);
|
|
48034
48049
|
if (this.parent !== childId && this.getId() !== childId) {
|
|
48035
|
-
|
|
48050
|
+
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
|
|
48051
|
+
if (canAddItem) {
|
|
48052
|
+
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
48036
48053
|
foundItem.transformation.apply({
|
|
48037
48054
|
class: "Transformation",
|
|
48038
48055
|
method: "translateTo",
|
|
48039
48056
|
item: [this.id],
|
|
48040
|
-
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
48041
|
-
y: this.top
|
|
48057
|
+
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
48058
|
+
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
48042
48059
|
});
|
|
48043
48060
|
this.board.items.index.remove(foundItem);
|
|
48044
48061
|
foundItem.parent = this.getId();
|
|
@@ -56544,11 +56561,11 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
56544
56561
|
}
|
|
56545
56562
|
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
56546
56563
|
board.setInterfaceType(msg.mode);
|
|
56564
|
+
board.subject.publish();
|
|
56547
56565
|
onBoardLoad(board);
|
|
56548
56566
|
}
|
|
56549
56567
|
function handleSeqNumApplication(initialSequenceNumber, board) {
|
|
56550
56568
|
const { log } = board.events;
|
|
56551
|
-
console.log(`upd seq number from ${log.currentSequenceNumber.toString()} to ${initialSequenceNumber}`);
|
|
56552
56569
|
log.currentSequenceNumber = initialSequenceNumber;
|
|
56553
56570
|
if (log.pendingEvent) {
|
|
56554
56571
|
log.pendingEvent.sequenceNumber = log.currentSequenceNumber;
|
package/dist/cjs/node.js
CHANGED
|
@@ -8106,7 +8106,7 @@ var conf = {
|
|
|
8106
8106
|
FALLBACK_LNG: "en",
|
|
8107
8107
|
cursorsMap,
|
|
8108
8108
|
DECK_HORIZONTAL_OFFSET: 2,
|
|
8109
|
-
DECK_VERTICAL_OFFSET:
|
|
8109
|
+
DECK_VERTICAL_OFFSET: 2,
|
|
8110
8110
|
CARD_DIMENSIONS: { width: 250, height: 400 }
|
|
8111
8111
|
};
|
|
8112
8112
|
initDefaultI18N();
|
|
@@ -44702,6 +44702,14 @@ class ImageItem extends BaseItem {
|
|
|
44702
44702
|
const ctx = context.ctx;
|
|
44703
44703
|
ctx.save();
|
|
44704
44704
|
this.transformation.matrix.applyToContext(ctx);
|
|
44705
|
+
const rotation = this.transformation.getRotation();
|
|
44706
|
+
if (rotation !== 0) {
|
|
44707
|
+
const imgWidth = this.image.width || 0;
|
|
44708
|
+
const imgHeight = this.image.height || 0;
|
|
44709
|
+
ctx.translate(imgWidth / 2, imgHeight / 2);
|
|
44710
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
44711
|
+
ctx.translate(-imgWidth / 2, -imgHeight / 2);
|
|
44712
|
+
}
|
|
44705
44713
|
ctx.drawImage(this.image, 0, 0);
|
|
44706
44714
|
ctx.restore();
|
|
44707
44715
|
if (this.getLinkTo()) {
|
|
@@ -50347,6 +50355,9 @@ class Card extends BaseItem {
|
|
|
50347
50355
|
getImage() {
|
|
50348
50356
|
return this.imageToRender;
|
|
50349
50357
|
}
|
|
50358
|
+
getIsRotatedPerpendicular() {
|
|
50359
|
+
return Boolean(this.transformation.getRotation() % 180);
|
|
50360
|
+
}
|
|
50350
50361
|
render(context, left, top) {
|
|
50351
50362
|
if (this.transformationRenderBlock) {
|
|
50352
50363
|
return;
|
|
@@ -50359,7 +50370,7 @@ class Card extends BaseItem {
|
|
|
50359
50370
|
const height3 = this.getHeight();
|
|
50360
50371
|
if (typeof left === "number" && typeof top === "number") {
|
|
50361
50372
|
centerX = left + width2 / 2;
|
|
50362
|
-
|
|
50373
|
+
centerY = top + height3 / 2;
|
|
50363
50374
|
}
|
|
50364
50375
|
ctx.translate(centerX, centerY);
|
|
50365
50376
|
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
@@ -50487,6 +50498,7 @@ class Deck extends BaseItem {
|
|
|
50487
50498
|
isCacheDirty = true;
|
|
50488
50499
|
enableResize = false;
|
|
50489
50500
|
path = null;
|
|
50501
|
+
isPerpendicular = undefined;
|
|
50490
50502
|
constructor(board, id = "") {
|
|
50491
50503
|
super(board, id, defaultDeckData, true);
|
|
50492
50504
|
this.index.getUnderPoint = () => [];
|
|
@@ -50498,6 +50510,9 @@ class Deck extends BaseItem {
|
|
|
50498
50510
|
});
|
|
50499
50511
|
this.updateMbr();
|
|
50500
50512
|
}
|
|
50513
|
+
getIsPerpendicular() {
|
|
50514
|
+
return this.isPerpendicular;
|
|
50515
|
+
}
|
|
50501
50516
|
applyAddChildren(childIds) {
|
|
50502
50517
|
if (!this.index) {
|
|
50503
50518
|
return;
|
|
@@ -50505,13 +50520,15 @@ class Deck extends BaseItem {
|
|
|
50505
50520
|
childIds.forEach((childId) => {
|
|
50506
50521
|
const foundItem = this.board.items.getById(childId);
|
|
50507
50522
|
if (this.parent !== childId && this.getId() !== childId) {
|
|
50508
|
-
|
|
50523
|
+
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
|
|
50524
|
+
if (canAddItem) {
|
|
50525
|
+
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
50509
50526
|
foundItem.transformation.apply({
|
|
50510
50527
|
class: "Transformation",
|
|
50511
50528
|
method: "translateTo",
|
|
50512
50529
|
item: [this.id],
|
|
50513
|
-
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
50514
|
-
y: this.top
|
|
50530
|
+
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
50531
|
+
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
50515
50532
|
});
|
|
50516
50533
|
this.board.items.index.remove(foundItem);
|
|
50517
50534
|
foundItem.parent = this.getId();
|
|
@@ -59017,11 +59034,11 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
59017
59034
|
}
|
|
59018
59035
|
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
59019
59036
|
board.setInterfaceType(msg.mode);
|
|
59037
|
+
board.subject.publish();
|
|
59020
59038
|
onBoardLoad(board);
|
|
59021
59039
|
}
|
|
59022
59040
|
function handleSeqNumApplication(initialSequenceNumber, board) {
|
|
59023
59041
|
const { log } = board.events;
|
|
59024
|
-
console.log(`upd seq number from ${log.currentSequenceNumber.toString()} to ${initialSequenceNumber}`);
|
|
59025
59042
|
log.currentSequenceNumber = initialSequenceNumber;
|
|
59026
59043
|
if (log.pendingEvent) {
|
|
59027
59044
|
log.pendingEvent.sequenceNumber = log.currentSequenceNumber;
|
package/dist/esm/browser.js
CHANGED
|
@@ -6906,7 +6906,7 @@ var conf = {
|
|
|
6906
6906
|
FALLBACK_LNG: "en",
|
|
6907
6907
|
cursorsMap,
|
|
6908
6908
|
DECK_HORIZONTAL_OFFSET: 2,
|
|
6909
|
-
DECK_VERTICAL_OFFSET:
|
|
6909
|
+
DECK_VERTICAL_OFFSET: 2,
|
|
6910
6910
|
CARD_DIMENSIONS: { width: 250, height: 400 }
|
|
6911
6911
|
};
|
|
6912
6912
|
initDefaultI18N();
|
|
@@ -42075,6 +42075,14 @@ class ImageItem extends BaseItem {
|
|
|
42075
42075
|
const ctx = context.ctx;
|
|
42076
42076
|
ctx.save();
|
|
42077
42077
|
this.transformation.matrix.applyToContext(ctx);
|
|
42078
|
+
const rotation = this.transformation.getRotation();
|
|
42079
|
+
if (rotation !== 0) {
|
|
42080
|
+
const imgWidth = this.image.width || 0;
|
|
42081
|
+
const imgHeight = this.image.height || 0;
|
|
42082
|
+
ctx.translate(imgWidth / 2, imgHeight / 2);
|
|
42083
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
42084
|
+
ctx.translate(-imgWidth / 2, -imgHeight / 2);
|
|
42085
|
+
}
|
|
42078
42086
|
ctx.drawImage(this.image, 0, 0);
|
|
42079
42087
|
ctx.restore();
|
|
42080
42088
|
if (this.getLinkTo()) {
|
|
@@ -47720,6 +47728,9 @@ class Card extends BaseItem {
|
|
|
47720
47728
|
getImage() {
|
|
47721
47729
|
return this.imageToRender;
|
|
47722
47730
|
}
|
|
47731
|
+
getIsRotatedPerpendicular() {
|
|
47732
|
+
return Boolean(this.transformation.getRotation() % 180);
|
|
47733
|
+
}
|
|
47723
47734
|
render(context, left, top) {
|
|
47724
47735
|
if (this.transformationRenderBlock) {
|
|
47725
47736
|
return;
|
|
@@ -47732,7 +47743,7 @@ class Card extends BaseItem {
|
|
|
47732
47743
|
const height3 = this.getHeight();
|
|
47733
47744
|
if (typeof left === "number" && typeof top === "number") {
|
|
47734
47745
|
centerX = left + width2 / 2;
|
|
47735
|
-
|
|
47746
|
+
centerY = top + height3 / 2;
|
|
47736
47747
|
}
|
|
47737
47748
|
ctx.translate(centerX, centerY);
|
|
47738
47749
|
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
@@ -47860,6 +47871,7 @@ class Deck extends BaseItem {
|
|
|
47860
47871
|
isCacheDirty = true;
|
|
47861
47872
|
enableResize = false;
|
|
47862
47873
|
path = null;
|
|
47874
|
+
isPerpendicular = undefined;
|
|
47863
47875
|
constructor(board, id = "") {
|
|
47864
47876
|
super(board, id, defaultDeckData, true);
|
|
47865
47877
|
this.index.getUnderPoint = () => [];
|
|
@@ -47871,6 +47883,9 @@ class Deck extends BaseItem {
|
|
|
47871
47883
|
});
|
|
47872
47884
|
this.updateMbr();
|
|
47873
47885
|
}
|
|
47886
|
+
getIsPerpendicular() {
|
|
47887
|
+
return this.isPerpendicular;
|
|
47888
|
+
}
|
|
47874
47889
|
applyAddChildren(childIds) {
|
|
47875
47890
|
if (!this.index) {
|
|
47876
47891
|
return;
|
|
@@ -47878,13 +47893,15 @@ class Deck extends BaseItem {
|
|
|
47878
47893
|
childIds.forEach((childId) => {
|
|
47879
47894
|
const foundItem = this.board.items.getById(childId);
|
|
47880
47895
|
if (this.parent !== childId && this.getId() !== childId) {
|
|
47881
|
-
|
|
47896
|
+
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
|
|
47897
|
+
if (canAddItem) {
|
|
47898
|
+
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
47882
47899
|
foundItem.transformation.apply({
|
|
47883
47900
|
class: "Transformation",
|
|
47884
47901
|
method: "translateTo",
|
|
47885
47902
|
item: [this.id],
|
|
47886
|
-
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
47887
|
-
y: this.top
|
|
47903
|
+
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
47904
|
+
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
47888
47905
|
});
|
|
47889
47906
|
this.board.items.index.remove(foundItem);
|
|
47890
47907
|
foundItem.parent = this.getId();
|
|
@@ -56390,11 +56407,11 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
56390
56407
|
}
|
|
56391
56408
|
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
56392
56409
|
board.setInterfaceType(msg.mode);
|
|
56410
|
+
board.subject.publish();
|
|
56393
56411
|
onBoardLoad(board);
|
|
56394
56412
|
}
|
|
56395
56413
|
function handleSeqNumApplication(initialSequenceNumber, board) {
|
|
56396
56414
|
const { log } = board.events;
|
|
56397
|
-
console.log(`upd seq number from ${log.currentSequenceNumber.toString()} to ${initialSequenceNumber}`);
|
|
56398
56415
|
log.currentSequenceNumber = initialSequenceNumber;
|
|
56399
56416
|
if (log.pendingEvent) {
|
|
56400
56417
|
log.pendingEvent.sequenceNumber = log.currentSequenceNumber;
|
package/dist/esm/index.js
CHANGED
|
@@ -6899,7 +6899,7 @@ var conf = {
|
|
|
6899
6899
|
FALLBACK_LNG: "en",
|
|
6900
6900
|
cursorsMap,
|
|
6901
6901
|
DECK_HORIZONTAL_OFFSET: 2,
|
|
6902
|
-
DECK_VERTICAL_OFFSET:
|
|
6902
|
+
DECK_VERTICAL_OFFSET: 2,
|
|
6903
6903
|
CARD_DIMENSIONS: { width: 250, height: 400 }
|
|
6904
6904
|
};
|
|
6905
6905
|
initDefaultI18N();
|
|
@@ -42068,6 +42068,14 @@ class ImageItem extends BaseItem {
|
|
|
42068
42068
|
const ctx = context.ctx;
|
|
42069
42069
|
ctx.save();
|
|
42070
42070
|
this.transformation.matrix.applyToContext(ctx);
|
|
42071
|
+
const rotation = this.transformation.getRotation();
|
|
42072
|
+
if (rotation !== 0) {
|
|
42073
|
+
const imgWidth = this.image.width || 0;
|
|
42074
|
+
const imgHeight = this.image.height || 0;
|
|
42075
|
+
ctx.translate(imgWidth / 2, imgHeight / 2);
|
|
42076
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
42077
|
+
ctx.translate(-imgWidth / 2, -imgHeight / 2);
|
|
42078
|
+
}
|
|
42071
42079
|
ctx.drawImage(this.image, 0, 0);
|
|
42072
42080
|
ctx.restore();
|
|
42073
42081
|
if (this.getLinkTo()) {
|
|
@@ -47713,6 +47721,9 @@ class Card extends BaseItem {
|
|
|
47713
47721
|
getImage() {
|
|
47714
47722
|
return this.imageToRender;
|
|
47715
47723
|
}
|
|
47724
|
+
getIsRotatedPerpendicular() {
|
|
47725
|
+
return Boolean(this.transformation.getRotation() % 180);
|
|
47726
|
+
}
|
|
47716
47727
|
render(context, left, top) {
|
|
47717
47728
|
if (this.transformationRenderBlock) {
|
|
47718
47729
|
return;
|
|
@@ -47725,7 +47736,7 @@ class Card extends BaseItem {
|
|
|
47725
47736
|
const height3 = this.getHeight();
|
|
47726
47737
|
if (typeof left === "number" && typeof top === "number") {
|
|
47727
47738
|
centerX = left + width2 / 2;
|
|
47728
|
-
|
|
47739
|
+
centerY = top + height3 / 2;
|
|
47729
47740
|
}
|
|
47730
47741
|
ctx.translate(centerX, centerY);
|
|
47731
47742
|
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
@@ -47853,6 +47864,7 @@ class Deck extends BaseItem {
|
|
|
47853
47864
|
isCacheDirty = true;
|
|
47854
47865
|
enableResize = false;
|
|
47855
47866
|
path = null;
|
|
47867
|
+
isPerpendicular = undefined;
|
|
47856
47868
|
constructor(board, id = "") {
|
|
47857
47869
|
super(board, id, defaultDeckData, true);
|
|
47858
47870
|
this.index.getUnderPoint = () => [];
|
|
@@ -47864,6 +47876,9 @@ class Deck extends BaseItem {
|
|
|
47864
47876
|
});
|
|
47865
47877
|
this.updateMbr();
|
|
47866
47878
|
}
|
|
47879
|
+
getIsPerpendicular() {
|
|
47880
|
+
return this.isPerpendicular;
|
|
47881
|
+
}
|
|
47867
47882
|
applyAddChildren(childIds) {
|
|
47868
47883
|
if (!this.index) {
|
|
47869
47884
|
return;
|
|
@@ -47871,13 +47886,15 @@ class Deck extends BaseItem {
|
|
|
47871
47886
|
childIds.forEach((childId) => {
|
|
47872
47887
|
const foundItem = this.board.items.getById(childId);
|
|
47873
47888
|
if (this.parent !== childId && this.getId() !== childId) {
|
|
47874
|
-
|
|
47889
|
+
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
|
|
47890
|
+
if (canAddItem) {
|
|
47891
|
+
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
47875
47892
|
foundItem.transformation.apply({
|
|
47876
47893
|
class: "Transformation",
|
|
47877
47894
|
method: "translateTo",
|
|
47878
47895
|
item: [this.id],
|
|
47879
|
-
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
47880
|
-
y: this.top
|
|
47896
|
+
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
47897
|
+
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
47881
47898
|
});
|
|
47882
47899
|
this.board.items.index.remove(foundItem);
|
|
47883
47900
|
foundItem.parent = this.getId();
|
|
@@ -56383,11 +56400,11 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
56383
56400
|
}
|
|
56384
56401
|
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
56385
56402
|
board.setInterfaceType(msg.mode);
|
|
56403
|
+
board.subject.publish();
|
|
56386
56404
|
onBoardLoad(board);
|
|
56387
56405
|
}
|
|
56388
56406
|
function handleSeqNumApplication(initialSequenceNumber, board) {
|
|
56389
56407
|
const { log } = board.events;
|
|
56390
|
-
console.log(`upd seq number from ${log.currentSequenceNumber.toString()} to ${initialSequenceNumber}`);
|
|
56391
56408
|
log.currentSequenceNumber = initialSequenceNumber;
|
|
56392
56409
|
if (log.pendingEvent) {
|
|
56393
56410
|
log.pendingEvent.sequenceNumber = log.currentSequenceNumber;
|
package/dist/esm/node.js
CHANGED
|
@@ -7683,7 +7683,7 @@ var conf = {
|
|
|
7683
7683
|
FALLBACK_LNG: "en",
|
|
7684
7684
|
cursorsMap,
|
|
7685
7685
|
DECK_HORIZONTAL_OFFSET: 2,
|
|
7686
|
-
DECK_VERTICAL_OFFSET:
|
|
7686
|
+
DECK_VERTICAL_OFFSET: 2,
|
|
7687
7687
|
CARD_DIMENSIONS: { width: 250, height: 400 }
|
|
7688
7688
|
};
|
|
7689
7689
|
initDefaultI18N();
|
|
@@ -44536,6 +44536,14 @@ class ImageItem extends BaseItem {
|
|
|
44536
44536
|
const ctx = context.ctx;
|
|
44537
44537
|
ctx.save();
|
|
44538
44538
|
this.transformation.matrix.applyToContext(ctx);
|
|
44539
|
+
const rotation = this.transformation.getRotation();
|
|
44540
|
+
if (rotation !== 0) {
|
|
44541
|
+
const imgWidth = this.image.width || 0;
|
|
44542
|
+
const imgHeight = this.image.height || 0;
|
|
44543
|
+
ctx.translate(imgWidth / 2, imgHeight / 2);
|
|
44544
|
+
ctx.rotate(rotation * Math.PI / 180);
|
|
44545
|
+
ctx.translate(-imgWidth / 2, -imgHeight / 2);
|
|
44546
|
+
}
|
|
44539
44547
|
ctx.drawImage(this.image, 0, 0);
|
|
44540
44548
|
ctx.restore();
|
|
44541
44549
|
if (this.getLinkTo()) {
|
|
@@ -50181,6 +50189,9 @@ class Card extends BaseItem {
|
|
|
50181
50189
|
getImage() {
|
|
50182
50190
|
return this.imageToRender;
|
|
50183
50191
|
}
|
|
50192
|
+
getIsRotatedPerpendicular() {
|
|
50193
|
+
return Boolean(this.transformation.getRotation() % 180);
|
|
50194
|
+
}
|
|
50184
50195
|
render(context, left, top) {
|
|
50185
50196
|
if (this.transformationRenderBlock) {
|
|
50186
50197
|
return;
|
|
@@ -50193,7 +50204,7 @@ class Card extends BaseItem {
|
|
|
50193
50204
|
const height3 = this.getHeight();
|
|
50194
50205
|
if (typeof left === "number" && typeof top === "number") {
|
|
50195
50206
|
centerX = left + width2 / 2;
|
|
50196
|
-
|
|
50207
|
+
centerY = top + height3 / 2;
|
|
50197
50208
|
}
|
|
50198
50209
|
ctx.translate(centerX, centerY);
|
|
50199
50210
|
ctx.rotate(this.transformation.getRotation() * Math.PI / 180);
|
|
@@ -50321,6 +50332,7 @@ class Deck extends BaseItem {
|
|
|
50321
50332
|
isCacheDirty = true;
|
|
50322
50333
|
enableResize = false;
|
|
50323
50334
|
path = null;
|
|
50335
|
+
isPerpendicular = undefined;
|
|
50324
50336
|
constructor(board, id = "") {
|
|
50325
50337
|
super(board, id, defaultDeckData, true);
|
|
50326
50338
|
this.index.getUnderPoint = () => [];
|
|
@@ -50332,6 +50344,9 @@ class Deck extends BaseItem {
|
|
|
50332
50344
|
});
|
|
50333
50345
|
this.updateMbr();
|
|
50334
50346
|
}
|
|
50347
|
+
getIsPerpendicular() {
|
|
50348
|
+
return this.isPerpendicular;
|
|
50349
|
+
}
|
|
50335
50350
|
applyAddChildren(childIds) {
|
|
50336
50351
|
if (!this.index) {
|
|
50337
50352
|
return;
|
|
@@ -50339,13 +50354,15 @@ class Deck extends BaseItem {
|
|
|
50339
50354
|
childIds.forEach((childId) => {
|
|
50340
50355
|
const foundItem = this.board.items.getById(childId);
|
|
50341
50356
|
if (this.parent !== childId && this.getId() !== childId) {
|
|
50342
|
-
|
|
50357
|
+
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular());
|
|
50358
|
+
if (canAddItem) {
|
|
50359
|
+
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
50343
50360
|
foundItem.transformation.apply({
|
|
50344
50361
|
class: "Transformation",
|
|
50345
50362
|
method: "translateTo",
|
|
50346
50363
|
item: [this.id],
|
|
50347
|
-
x: this.left + (this.index?.list().length || 0) * conf.DECK_HORIZONTAL_OFFSET,
|
|
50348
|
-
y: this.top
|
|
50364
|
+
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
50365
|
+
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
50349
50366
|
});
|
|
50350
50367
|
this.board.items.index.remove(foundItem);
|
|
50351
50368
|
foundItem.parent = this.getId();
|
|
@@ -58851,11 +58868,11 @@ function handleBoardSubscriptionCompletedMsg(msg, board) {
|
|
|
58851
58868
|
}
|
|
58852
58869
|
handleBoardEventListApplication(msg.eventsSinceLastSnapshot, board);
|
|
58853
58870
|
board.setInterfaceType(msg.mode);
|
|
58871
|
+
board.subject.publish();
|
|
58854
58872
|
onBoardLoad(board);
|
|
58855
58873
|
}
|
|
58856
58874
|
function handleSeqNumApplication(initialSequenceNumber, board) {
|
|
58857
58875
|
const { log } = board.events;
|
|
58858
|
-
console.log(`upd seq number from ${log.currentSequenceNumber.toString()} to ${initialSequenceNumber}`);
|
|
58859
58876
|
log.currentSequenceNumber = initialSequenceNumber;
|
|
58860
58877
|
if (log.pendingEvent) {
|
|
58861
58878
|
log.pendingEvent.sequenceNumber = log.currentSequenceNumber;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Board } from
|
|
2
|
-
import { BoardSubscriptionCompletedMsg } from
|
|
1
|
+
import { Board } from "../../Board";
|
|
2
|
+
import { BoardSubscriptionCompletedMsg } from "./boardMessageInterface";
|
|
3
3
|
export declare function handleBoardSubscriptionCompletedMsg(msg: BoardSubscriptionCompletedMsg, board: Board): void;
|
|
4
4
|
export declare function handleSeqNumApplication(initialSequenceNumber: number, board: Board): void;
|
|
5
5
|
export declare function startIntervals(board: Board): void;
|
|
@@ -25,6 +25,7 @@ export declare class Card extends BaseItem {
|
|
|
25
25
|
createImages(): void;
|
|
26
26
|
updateImageToRender(): void;
|
|
27
27
|
getImage(): HTMLImageElement | null;
|
|
28
|
+
getIsRotatedPerpendicular(): boolean;
|
|
28
29
|
render(context: DrawingContext, left?: number, top?: number): void;
|
|
29
30
|
renderHTML(documentFactory: DocumentFactory): HTMLElement;
|
|
30
31
|
updateMbr(): void;
|
|
@@ -14,7 +14,9 @@ export declare class Deck extends BaseItem {
|
|
|
14
14
|
private isCacheDirty;
|
|
15
15
|
enableResize: boolean;
|
|
16
16
|
path: Path | null;
|
|
17
|
+
private isPerpendicular;
|
|
17
18
|
constructor(board: Board, id?: string);
|
|
19
|
+
getIsPerpendicular(): boolean | undefined;
|
|
18
20
|
applyAddChildren(childIds: string[]): void;
|
|
19
21
|
applyRemoveChildren(childIds: string[]): void;
|
|
20
22
|
getDeck(): Card[];
|