microboard-temp 0.5.29 → 0.5.31
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 +50 -15
- package/dist/cjs/index.js +50 -15
- package/dist/cjs/node.js +50 -15
- package/dist/esm/browser.js +50 -15
- package/dist/esm/index.js +50 -15
- package/dist/esm/node.js +50 -15
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -47834,6 +47834,19 @@ function throttle(func, delay) {
|
|
|
47834
47834
|
};
|
|
47835
47835
|
}
|
|
47836
47836
|
|
|
47837
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
47838
|
+
var editModeHotkeyRegistry = {};
|
|
47839
|
+
var viewModeHotkeyRegistry = {};
|
|
47840
|
+
var hotkeyNames = {};
|
|
47841
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
47842
|
+
if (boardMode === "edit") {
|
|
47843
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47844
|
+
} else {
|
|
47845
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47846
|
+
}
|
|
47847
|
+
hotkeyNames[name] = hotkey;
|
|
47848
|
+
}
|
|
47849
|
+
|
|
47837
47850
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
47838
47851
|
var defaultCardData = {
|
|
47839
47852
|
itemType: "Card",
|
|
@@ -48012,19 +48025,40 @@ registerItem({
|
|
|
48012
48025
|
item: Card,
|
|
48013
48026
|
defaultData: defaultCardData
|
|
48014
48027
|
});
|
|
48015
|
-
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
|
|
48019
|
-
|
|
48020
|
-
|
|
48021
|
-
|
|
48022
|
-
|
|
48023
|
-
|
|
48028
|
+
registerHotkey({
|
|
48029
|
+
name: "Rotate90deg",
|
|
48030
|
+
hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
|
|
48031
|
+
boardMode: "edit",
|
|
48032
|
+
hotkeyConfig: {
|
|
48033
|
+
allItemsType: ["Image", "Card"],
|
|
48034
|
+
cb: (event, board) => {
|
|
48035
|
+
const items = board?.selection.items.list();
|
|
48036
|
+
if (!items) {
|
|
48037
|
+
return;
|
|
48038
|
+
}
|
|
48039
|
+
items.forEach((item) => {
|
|
48040
|
+
item.rotate(false);
|
|
48041
|
+
});
|
|
48042
|
+
}
|
|
48024
48043
|
}
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
48044
|
+
});
|
|
48045
|
+
registerHotkey({
|
|
48046
|
+
name: "Rotate90deg-clockwise",
|
|
48047
|
+
hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
|
|
48048
|
+
boardMode: "edit",
|
|
48049
|
+
hotkeyConfig: {
|
|
48050
|
+
allItemsType: ["Image", "Card"],
|
|
48051
|
+
cb: (event, board) => {
|
|
48052
|
+
const items = board?.selection.items.list();
|
|
48053
|
+
if (!items) {
|
|
48054
|
+
return;
|
|
48055
|
+
}
|
|
48056
|
+
items.forEach((item) => {
|
|
48057
|
+
item.rotate(true);
|
|
48058
|
+
});
|
|
48059
|
+
}
|
|
48060
|
+
}
|
|
48061
|
+
});
|
|
48028
48062
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
48029
48063
|
var defaultDeckData = {
|
|
48030
48064
|
itemType: "Deck"
|
|
@@ -48069,6 +48103,7 @@ class Deck extends BaseItem {
|
|
|
48069
48103
|
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
48070
48104
|
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
48071
48105
|
});
|
|
48106
|
+
this.board.selection.remove(foundItem);
|
|
48072
48107
|
this.board.items.index.remove(foundItem);
|
|
48073
48108
|
foundItem.parent = this.getId();
|
|
48074
48109
|
foundItem.shouldUseRelativeAlignment = false;
|
|
@@ -48158,8 +48193,8 @@ class Deck extends BaseItem {
|
|
|
48158
48193
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
48159
48194
|
this.left = translateX;
|
|
48160
48195
|
this.top = translateY;
|
|
48161
|
-
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
|
|
48162
|
-
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height
|
|
48196
|
+
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
|
|
48197
|
+
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
|
|
48163
48198
|
this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
|
|
48164
48199
|
}
|
|
48165
48200
|
deserialize(data) {
|
|
@@ -48226,7 +48261,7 @@ class Deck extends BaseItem {
|
|
|
48226
48261
|
return;
|
|
48227
48262
|
const tempContext = { ...context, ctx: tempCtx };
|
|
48228
48263
|
cards.forEach((_, index2) => {
|
|
48229
|
-
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
48264
|
+
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
48230
48265
|
});
|
|
48231
48266
|
this.cachedCanvas = tempCanvas;
|
|
48232
48267
|
this.isCacheDirty = false;
|
package/dist/cjs/index.js
CHANGED
|
@@ -47834,6 +47834,19 @@ function throttle(func, delay) {
|
|
|
47834
47834
|
};
|
|
47835
47835
|
}
|
|
47836
47836
|
|
|
47837
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
47838
|
+
var editModeHotkeyRegistry = {};
|
|
47839
|
+
var viewModeHotkeyRegistry = {};
|
|
47840
|
+
var hotkeyNames = {};
|
|
47841
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
47842
|
+
if (boardMode === "edit") {
|
|
47843
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47844
|
+
} else {
|
|
47845
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47846
|
+
}
|
|
47847
|
+
hotkeyNames[name] = hotkey;
|
|
47848
|
+
}
|
|
47849
|
+
|
|
47837
47850
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
47838
47851
|
var defaultCardData = {
|
|
47839
47852
|
itemType: "Card",
|
|
@@ -48012,19 +48025,40 @@ registerItem({
|
|
|
48012
48025
|
item: Card,
|
|
48013
48026
|
defaultData: defaultCardData
|
|
48014
48027
|
});
|
|
48015
|
-
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
|
|
48019
|
-
|
|
48020
|
-
|
|
48021
|
-
|
|
48022
|
-
|
|
48023
|
-
|
|
48028
|
+
registerHotkey({
|
|
48029
|
+
name: "Rotate90deg",
|
|
48030
|
+
hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
|
|
48031
|
+
boardMode: "edit",
|
|
48032
|
+
hotkeyConfig: {
|
|
48033
|
+
allItemsType: ["Image", "Card"],
|
|
48034
|
+
cb: (event, board) => {
|
|
48035
|
+
const items = board?.selection.items.list();
|
|
48036
|
+
if (!items) {
|
|
48037
|
+
return;
|
|
48038
|
+
}
|
|
48039
|
+
items.forEach((item) => {
|
|
48040
|
+
item.rotate(false);
|
|
48041
|
+
});
|
|
48042
|
+
}
|
|
48024
48043
|
}
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
48044
|
+
});
|
|
48045
|
+
registerHotkey({
|
|
48046
|
+
name: "Rotate90deg-clockwise",
|
|
48047
|
+
hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
|
|
48048
|
+
boardMode: "edit",
|
|
48049
|
+
hotkeyConfig: {
|
|
48050
|
+
allItemsType: ["Image", "Card"],
|
|
48051
|
+
cb: (event, board) => {
|
|
48052
|
+
const items = board?.selection.items.list();
|
|
48053
|
+
if (!items) {
|
|
48054
|
+
return;
|
|
48055
|
+
}
|
|
48056
|
+
items.forEach((item) => {
|
|
48057
|
+
item.rotate(true);
|
|
48058
|
+
});
|
|
48059
|
+
}
|
|
48060
|
+
}
|
|
48061
|
+
});
|
|
48028
48062
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
48029
48063
|
var defaultDeckData = {
|
|
48030
48064
|
itemType: "Deck"
|
|
@@ -48069,6 +48103,7 @@ class Deck extends BaseItem {
|
|
|
48069
48103
|
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
48070
48104
|
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
48071
48105
|
});
|
|
48106
|
+
this.board.selection.remove(foundItem);
|
|
48072
48107
|
this.board.items.index.remove(foundItem);
|
|
48073
48108
|
foundItem.parent = this.getId();
|
|
48074
48109
|
foundItem.shouldUseRelativeAlignment = false;
|
|
@@ -48158,8 +48193,8 @@ class Deck extends BaseItem {
|
|
|
48158
48193
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
48159
48194
|
this.left = translateX;
|
|
48160
48195
|
this.top = translateY;
|
|
48161
|
-
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
|
|
48162
|
-
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height
|
|
48196
|
+
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
|
|
48197
|
+
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
|
|
48163
48198
|
this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
|
|
48164
48199
|
}
|
|
48165
48200
|
deserialize(data) {
|
|
@@ -48226,7 +48261,7 @@ class Deck extends BaseItem {
|
|
|
48226
48261
|
return;
|
|
48227
48262
|
const tempContext = { ...context, ctx: tempCtx };
|
|
48228
48263
|
cards.forEach((_, index2) => {
|
|
48229
|
-
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
48264
|
+
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
48230
48265
|
});
|
|
48231
48266
|
this.cachedCanvas = tempCanvas;
|
|
48232
48267
|
this.isCacheDirty = false;
|
package/dist/cjs/node.js
CHANGED
|
@@ -50307,6 +50307,19 @@ function throttle(func, delay) {
|
|
|
50307
50307
|
};
|
|
50308
50308
|
}
|
|
50309
50309
|
|
|
50310
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
50311
|
+
var editModeHotkeyRegistry = {};
|
|
50312
|
+
var viewModeHotkeyRegistry = {};
|
|
50313
|
+
var hotkeyNames = {};
|
|
50314
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
50315
|
+
if (boardMode === "edit") {
|
|
50316
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
50317
|
+
} else {
|
|
50318
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
50319
|
+
}
|
|
50320
|
+
hotkeyNames[name] = hotkey;
|
|
50321
|
+
}
|
|
50322
|
+
|
|
50310
50323
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
50311
50324
|
var defaultCardData = {
|
|
50312
50325
|
itemType: "Card",
|
|
@@ -50485,19 +50498,40 @@ registerItem({
|
|
|
50485
50498
|
item: Card,
|
|
50486
50499
|
defaultData: defaultCardData
|
|
50487
50500
|
});
|
|
50488
|
-
|
|
50489
|
-
|
|
50490
|
-
|
|
50491
|
-
|
|
50492
|
-
|
|
50493
|
-
|
|
50494
|
-
|
|
50495
|
-
|
|
50496
|
-
|
|
50501
|
+
registerHotkey({
|
|
50502
|
+
name: "Rotate90deg",
|
|
50503
|
+
hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
|
|
50504
|
+
boardMode: "edit",
|
|
50505
|
+
hotkeyConfig: {
|
|
50506
|
+
allItemsType: ["Image", "Card"],
|
|
50507
|
+
cb: (event, board) => {
|
|
50508
|
+
const items = board?.selection.items.list();
|
|
50509
|
+
if (!items) {
|
|
50510
|
+
return;
|
|
50511
|
+
}
|
|
50512
|
+
items.forEach((item) => {
|
|
50513
|
+
item.rotate(false);
|
|
50514
|
+
});
|
|
50515
|
+
}
|
|
50497
50516
|
}
|
|
50498
|
-
|
|
50499
|
-
|
|
50500
|
-
|
|
50517
|
+
});
|
|
50518
|
+
registerHotkey({
|
|
50519
|
+
name: "Rotate90deg-clockwise",
|
|
50520
|
+
hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
|
|
50521
|
+
boardMode: "edit",
|
|
50522
|
+
hotkeyConfig: {
|
|
50523
|
+
allItemsType: ["Image", "Card"],
|
|
50524
|
+
cb: (event, board) => {
|
|
50525
|
+
const items = board?.selection.items.list();
|
|
50526
|
+
if (!items) {
|
|
50527
|
+
return;
|
|
50528
|
+
}
|
|
50529
|
+
items.forEach((item) => {
|
|
50530
|
+
item.rotate(true);
|
|
50531
|
+
});
|
|
50532
|
+
}
|
|
50533
|
+
}
|
|
50534
|
+
});
|
|
50501
50535
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
50502
50536
|
var defaultDeckData = {
|
|
50503
50537
|
itemType: "Deck"
|
|
@@ -50542,6 +50576,7 @@ class Deck extends BaseItem {
|
|
|
50542
50576
|
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
50543
50577
|
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
50544
50578
|
});
|
|
50579
|
+
this.board.selection.remove(foundItem);
|
|
50545
50580
|
this.board.items.index.remove(foundItem);
|
|
50546
50581
|
foundItem.parent = this.getId();
|
|
50547
50582
|
foundItem.shouldUseRelativeAlignment = false;
|
|
@@ -50631,8 +50666,8 @@ class Deck extends BaseItem {
|
|
|
50631
50666
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
50632
50667
|
this.left = translateX;
|
|
50633
50668
|
this.top = translateY;
|
|
50634
|
-
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
|
|
50635
|
-
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height
|
|
50669
|
+
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
|
|
50670
|
+
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
|
|
50636
50671
|
this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
|
|
50637
50672
|
}
|
|
50638
50673
|
deserialize(data) {
|
|
@@ -50699,7 +50734,7 @@ class Deck extends BaseItem {
|
|
|
50699
50734
|
return;
|
|
50700
50735
|
const tempContext = { ...context, ctx: tempCtx };
|
|
50701
50736
|
cards.forEach((_, index2) => {
|
|
50702
|
-
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
50737
|
+
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
50703
50738
|
});
|
|
50704
50739
|
this.cachedCanvas = tempCanvas;
|
|
50705
50740
|
this.isCacheDirty = false;
|
package/dist/esm/browser.js
CHANGED
|
@@ -47680,6 +47680,19 @@ function throttle(func, delay) {
|
|
|
47680
47680
|
};
|
|
47681
47681
|
}
|
|
47682
47682
|
|
|
47683
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
47684
|
+
var editModeHotkeyRegistry = {};
|
|
47685
|
+
var viewModeHotkeyRegistry = {};
|
|
47686
|
+
var hotkeyNames = {};
|
|
47687
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
47688
|
+
if (boardMode === "edit") {
|
|
47689
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47690
|
+
} else {
|
|
47691
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47692
|
+
}
|
|
47693
|
+
hotkeyNames[name] = hotkey;
|
|
47694
|
+
}
|
|
47695
|
+
|
|
47683
47696
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
47684
47697
|
var defaultCardData = {
|
|
47685
47698
|
itemType: "Card",
|
|
@@ -47858,19 +47871,40 @@ registerItem({
|
|
|
47858
47871
|
item: Card,
|
|
47859
47872
|
defaultData: defaultCardData
|
|
47860
47873
|
});
|
|
47861
|
-
|
|
47862
|
-
|
|
47863
|
-
|
|
47864
|
-
|
|
47865
|
-
|
|
47866
|
-
|
|
47867
|
-
|
|
47868
|
-
|
|
47869
|
-
|
|
47874
|
+
registerHotkey({
|
|
47875
|
+
name: "Rotate90deg",
|
|
47876
|
+
hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
|
|
47877
|
+
boardMode: "edit",
|
|
47878
|
+
hotkeyConfig: {
|
|
47879
|
+
allItemsType: ["Image", "Card"],
|
|
47880
|
+
cb: (event, board) => {
|
|
47881
|
+
const items = board?.selection.items.list();
|
|
47882
|
+
if (!items) {
|
|
47883
|
+
return;
|
|
47884
|
+
}
|
|
47885
|
+
items.forEach((item) => {
|
|
47886
|
+
item.rotate(false);
|
|
47887
|
+
});
|
|
47888
|
+
}
|
|
47870
47889
|
}
|
|
47871
|
-
|
|
47872
|
-
|
|
47873
|
-
|
|
47890
|
+
});
|
|
47891
|
+
registerHotkey({
|
|
47892
|
+
name: "Rotate90deg-clockwise",
|
|
47893
|
+
hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
|
|
47894
|
+
boardMode: "edit",
|
|
47895
|
+
hotkeyConfig: {
|
|
47896
|
+
allItemsType: ["Image", "Card"],
|
|
47897
|
+
cb: (event, board) => {
|
|
47898
|
+
const items = board?.selection.items.list();
|
|
47899
|
+
if (!items) {
|
|
47900
|
+
return;
|
|
47901
|
+
}
|
|
47902
|
+
items.forEach((item) => {
|
|
47903
|
+
item.rotate(true);
|
|
47904
|
+
});
|
|
47905
|
+
}
|
|
47906
|
+
}
|
|
47907
|
+
});
|
|
47874
47908
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
47875
47909
|
var defaultDeckData = {
|
|
47876
47910
|
itemType: "Deck"
|
|
@@ -47915,6 +47949,7 @@ class Deck extends BaseItem {
|
|
|
47915
47949
|
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
47916
47950
|
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
47917
47951
|
});
|
|
47952
|
+
this.board.selection.remove(foundItem);
|
|
47918
47953
|
this.board.items.index.remove(foundItem);
|
|
47919
47954
|
foundItem.parent = this.getId();
|
|
47920
47955
|
foundItem.shouldUseRelativeAlignment = false;
|
|
@@ -48004,8 +48039,8 @@ class Deck extends BaseItem {
|
|
|
48004
48039
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
48005
48040
|
this.left = translateX;
|
|
48006
48041
|
this.top = translateY;
|
|
48007
|
-
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
|
|
48008
|
-
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height
|
|
48042
|
+
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
|
|
48043
|
+
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
|
|
48009
48044
|
this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
|
|
48010
48045
|
}
|
|
48011
48046
|
deserialize(data) {
|
|
@@ -48072,7 +48107,7 @@ class Deck extends BaseItem {
|
|
|
48072
48107
|
return;
|
|
48073
48108
|
const tempContext = { ...context, ctx: tempCtx };
|
|
48074
48109
|
cards.forEach((_, index2) => {
|
|
48075
|
-
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
48110
|
+
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
48076
48111
|
});
|
|
48077
48112
|
this.cachedCanvas = tempCanvas;
|
|
48078
48113
|
this.isCacheDirty = false;
|
package/dist/esm/index.js
CHANGED
|
@@ -47673,6 +47673,19 @@ function throttle(func, delay) {
|
|
|
47673
47673
|
};
|
|
47674
47674
|
}
|
|
47675
47675
|
|
|
47676
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
47677
|
+
var editModeHotkeyRegistry = {};
|
|
47678
|
+
var viewModeHotkeyRegistry = {};
|
|
47679
|
+
var hotkeyNames = {};
|
|
47680
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
47681
|
+
if (boardMode === "edit") {
|
|
47682
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47683
|
+
} else {
|
|
47684
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
47685
|
+
}
|
|
47686
|
+
hotkeyNames[name] = hotkey;
|
|
47687
|
+
}
|
|
47688
|
+
|
|
47676
47689
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
47677
47690
|
var defaultCardData = {
|
|
47678
47691
|
itemType: "Card",
|
|
@@ -47851,19 +47864,40 @@ registerItem({
|
|
|
47851
47864
|
item: Card,
|
|
47852
47865
|
defaultData: defaultCardData
|
|
47853
47866
|
});
|
|
47854
|
-
|
|
47855
|
-
|
|
47856
|
-
|
|
47857
|
-
|
|
47858
|
-
|
|
47859
|
-
|
|
47860
|
-
|
|
47861
|
-
|
|
47862
|
-
|
|
47867
|
+
registerHotkey({
|
|
47868
|
+
name: "Rotate90deg",
|
|
47869
|
+
hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
|
|
47870
|
+
boardMode: "edit",
|
|
47871
|
+
hotkeyConfig: {
|
|
47872
|
+
allItemsType: ["Image", "Card"],
|
|
47873
|
+
cb: (event, board) => {
|
|
47874
|
+
const items = board?.selection.items.list();
|
|
47875
|
+
if (!items) {
|
|
47876
|
+
return;
|
|
47877
|
+
}
|
|
47878
|
+
items.forEach((item) => {
|
|
47879
|
+
item.rotate(false);
|
|
47880
|
+
});
|
|
47881
|
+
}
|
|
47863
47882
|
}
|
|
47864
|
-
|
|
47865
|
-
|
|
47866
|
-
|
|
47883
|
+
});
|
|
47884
|
+
registerHotkey({
|
|
47885
|
+
name: "Rotate90deg-clockwise",
|
|
47886
|
+
hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
|
|
47887
|
+
boardMode: "edit",
|
|
47888
|
+
hotkeyConfig: {
|
|
47889
|
+
allItemsType: ["Image", "Card"],
|
|
47890
|
+
cb: (event, board) => {
|
|
47891
|
+
const items = board?.selection.items.list();
|
|
47892
|
+
if (!items) {
|
|
47893
|
+
return;
|
|
47894
|
+
}
|
|
47895
|
+
items.forEach((item) => {
|
|
47896
|
+
item.rotate(true);
|
|
47897
|
+
});
|
|
47898
|
+
}
|
|
47899
|
+
}
|
|
47900
|
+
});
|
|
47867
47901
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
47868
47902
|
var defaultDeckData = {
|
|
47869
47903
|
itemType: "Deck"
|
|
@@ -47908,6 +47942,7 @@ class Deck extends BaseItem {
|
|
|
47908
47942
|
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
47909
47943
|
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
47910
47944
|
});
|
|
47945
|
+
this.board.selection.remove(foundItem);
|
|
47911
47946
|
this.board.items.index.remove(foundItem);
|
|
47912
47947
|
foundItem.parent = this.getId();
|
|
47913
47948
|
foundItem.shouldUseRelativeAlignment = false;
|
|
@@ -47997,8 +48032,8 @@ class Deck extends BaseItem {
|
|
|
47997
48032
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
47998
48033
|
this.left = translateX;
|
|
47999
48034
|
this.top = translateY;
|
|
48000
|
-
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
|
|
48001
|
-
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height
|
|
48035
|
+
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
|
|
48036
|
+
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
|
|
48002
48037
|
this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
|
|
48003
48038
|
}
|
|
48004
48039
|
deserialize(data) {
|
|
@@ -48065,7 +48100,7 @@ class Deck extends BaseItem {
|
|
|
48065
48100
|
return;
|
|
48066
48101
|
const tempContext = { ...context, ctx: tempCtx };
|
|
48067
48102
|
cards.forEach((_, index2) => {
|
|
48068
|
-
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
48103
|
+
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
48069
48104
|
});
|
|
48070
48105
|
this.cachedCanvas = tempCanvas;
|
|
48071
48106
|
this.isCacheDirty = false;
|
package/dist/esm/node.js
CHANGED
|
@@ -50141,6 +50141,19 @@ function throttle(func, delay) {
|
|
|
50141
50141
|
};
|
|
50142
50142
|
}
|
|
50143
50143
|
|
|
50144
|
+
// src/Keyboard/HotkeyRegistry.ts
|
|
50145
|
+
var editModeHotkeyRegistry = {};
|
|
50146
|
+
var viewModeHotkeyRegistry = {};
|
|
50147
|
+
var hotkeyNames = {};
|
|
50148
|
+
function registerHotkey({ name, hotkey, hotkeyConfig, boardMode }) {
|
|
50149
|
+
if (boardMode === "edit") {
|
|
50150
|
+
editModeHotkeyRegistry[name] = hotkeyConfig;
|
|
50151
|
+
} else {
|
|
50152
|
+
viewModeHotkeyRegistry[name] = hotkeyConfig;
|
|
50153
|
+
}
|
|
50154
|
+
hotkeyNames[name] = hotkey;
|
|
50155
|
+
}
|
|
50156
|
+
|
|
50144
50157
|
// src/Items/Examples/CardGame/Card/Card.ts
|
|
50145
50158
|
var defaultCardData = {
|
|
50146
50159
|
itemType: "Card",
|
|
@@ -50319,19 +50332,40 @@ registerItem({
|
|
|
50319
50332
|
item: Card,
|
|
50320
50333
|
defaultData: defaultCardData
|
|
50321
50334
|
});
|
|
50322
|
-
|
|
50323
|
-
|
|
50324
|
-
|
|
50325
|
-
|
|
50326
|
-
|
|
50327
|
-
|
|
50328
|
-
|
|
50329
|
-
|
|
50330
|
-
|
|
50335
|
+
registerHotkey({
|
|
50336
|
+
name: "Rotate90deg",
|
|
50337
|
+
hotkey: { key: { button: "KeyQ" }, label: { windows: "Q", mac: "Q" } },
|
|
50338
|
+
boardMode: "edit",
|
|
50339
|
+
hotkeyConfig: {
|
|
50340
|
+
allItemsType: ["Image", "Card"],
|
|
50341
|
+
cb: (event, board) => {
|
|
50342
|
+
const items = board?.selection.items.list();
|
|
50343
|
+
if (!items) {
|
|
50344
|
+
return;
|
|
50345
|
+
}
|
|
50346
|
+
items.forEach((item) => {
|
|
50347
|
+
item.rotate(false);
|
|
50348
|
+
});
|
|
50349
|
+
}
|
|
50331
50350
|
}
|
|
50332
|
-
|
|
50333
|
-
|
|
50334
|
-
|
|
50351
|
+
});
|
|
50352
|
+
registerHotkey({
|
|
50353
|
+
name: "Rotate90deg-clockwise",
|
|
50354
|
+
hotkey: { key: { button: "KeyE" }, label: { windows: "E", mac: "E" } },
|
|
50355
|
+
boardMode: "edit",
|
|
50356
|
+
hotkeyConfig: {
|
|
50357
|
+
allItemsType: ["Image", "Card"],
|
|
50358
|
+
cb: (event, board) => {
|
|
50359
|
+
const items = board?.selection.items.list();
|
|
50360
|
+
if (!items) {
|
|
50361
|
+
return;
|
|
50362
|
+
}
|
|
50363
|
+
items.forEach((item) => {
|
|
50364
|
+
item.rotate(true);
|
|
50365
|
+
});
|
|
50366
|
+
}
|
|
50367
|
+
}
|
|
50368
|
+
});
|
|
50335
50369
|
// src/Items/Examples/CardGame/Deck/Deck.ts
|
|
50336
50370
|
var defaultDeckData = {
|
|
50337
50371
|
itemType: "Deck"
|
|
@@ -50376,6 +50410,7 @@ class Deck extends BaseItem {
|
|
|
50376
50410
|
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
50377
50411
|
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
50378
50412
|
});
|
|
50413
|
+
this.board.selection.remove(foundItem);
|
|
50379
50414
|
this.board.items.index.remove(foundItem);
|
|
50380
50415
|
foundItem.parent = this.getId();
|
|
50381
50416
|
foundItem.shouldUseRelativeAlignment = false;
|
|
@@ -50465,8 +50500,8 @@ class Deck extends BaseItem {
|
|
|
50465
50500
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
50466
50501
|
this.left = translateX;
|
|
50467
50502
|
this.top = translateY;
|
|
50468
|
-
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1));
|
|
50469
|
-
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height
|
|
50503
|
+
this.right = translateX + (itemsMbr?.getWidth() || conf.CARD_DIMENSIONS.width + (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET * ((this.children.length || 1) - 1)));
|
|
50504
|
+
this.bottom = translateY + (itemsMbr?.getHeight() || conf.CARD_DIMENSIONS.height + (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET * ((this.children.length || 1) - 1) : 0));
|
|
50470
50505
|
this.path = new Path(this.getMbr().getLines(), true, "#FFFFFF");
|
|
50471
50506
|
}
|
|
50472
50507
|
deserialize(data) {
|
|
@@ -50533,7 +50568,7 @@ class Deck extends BaseItem {
|
|
|
50533
50568
|
return;
|
|
50534
50569
|
const tempContext = { ...context, ctx: tempCtx };
|
|
50535
50570
|
cards.forEach((_, index2) => {
|
|
50536
|
-
topCard.render(tempContext, index2 * conf.DECK_HORIZONTAL_OFFSET, index2 * conf.DECK_VERTICAL_OFFSET);
|
|
50571
|
+
topCard.render(tempContext, this.isPerpendicular ? 0 : index2 * conf.DECK_HORIZONTAL_OFFSET, this.isPerpendicular ? index2 * conf.DECK_VERTICAL_OFFSET : 0);
|
|
50537
50572
|
});
|
|
50538
50573
|
this.cachedCanvas = tempCanvas;
|
|
50539
50574
|
this.isCacheDirty = false;
|