microboard-ui-temp 0.1.135 → 0.1.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -276607,8 +276607,7 @@ class Screen extends BaseItem {
276607
276607
  if (this.backgroundImage && this.backgroundImage.complete) {
276608
276608
  const ctx = context.ctx;
276609
276609
  ctx.save();
276610
- this.transformation.matrix.applyToContext(ctx);
276611
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
276610
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
276612
276611
  ctx.restore();
276613
276612
  }
276614
276613
  this.path.render(context);
@@ -374984,6 +374983,19 @@ function GetCard({ cardPosition, rounded = "none" }) {
374984
374983
 
374985
374984
  // src/features/ContextPanel/Buttons/CardGame/Card/CreateDeck.tsx
374986
374985
  var import_react285 = __toESM(require_react(), 1);
374986
+ function sortItemsByPosition(items) {
374987
+ return items.sort((a9, b16) => {
374988
+ if (a9.top < b16.top)
374989
+ return -1;
374990
+ if (a9.top > b16.top)
374991
+ return 1;
374992
+ if (a9.left < b16.left)
374993
+ return -1;
374994
+ if (a9.left > b16.left)
374995
+ return 1;
374996
+ return 0;
374997
+ });
374998
+ }
374987
374999
  function CreateDeck({ rounded = "none", onlyCards }) {
374988
375000
  const { board } = useAppContext();
374989
375001
  const { t: t10 } = useTranslation();
@@ -374991,7 +375003,7 @@ function CreateDeck({ rounded = "none", onlyCards }) {
374991
375003
  if (single && single.itemType === "Deck") {
374992
375004
  return null;
374993
375005
  }
374994
- const cardsOrDecks = board.selection.items.list();
375006
+ const cardsOrDecks = sortItemsByPosition(board.selection.items.list());
374995
375007
  const handleClick = () => {
374996
375008
  if (onlyCards) {
374997
375009
  const deck = new Deck(board, "");
@@ -374999,8 +375011,8 @@ function CreateDeck({ rounded = "none", onlyCards }) {
374999
375011
  class: "Transformation",
375000
375012
  method: "translateTo",
375001
375013
  item: [deck.getId()],
375002
- x: cardsOrDecks[cardsOrDecks.length - 1].left,
375003
- y: cardsOrDecks[cardsOrDecks.length - 1].top
375014
+ x: cardsOrDecks[0].left,
375015
+ y: cardsOrDecks[0].top
375004
375016
  });
375005
375017
  const addedDeck = board.add(deck);
375006
375018
  board.selection.items.removeAll();
@@ -375014,9 +375026,8 @@ function CreateDeck({ rounded = "none", onlyCards }) {
375014
375026
  cards.push(item);
375015
375027
  } else if (item.itemType === "Deck") {
375016
375028
  if (mainDeck) {
375017
- cards.push(...mainDeck.getDeck());
375018
- board.remove(mainDeck);
375019
- mainDeck = item;
375029
+ cards.push(...item.getDeck());
375030
+ board.remove(item);
375020
375031
  } else {
375021
375032
  mainDeck = item;
375022
375033
  }
package/dist/spa.js CHANGED
@@ -276607,8 +276607,7 @@ class Screen extends BaseItem {
276607
276607
  if (this.backgroundImage && this.backgroundImage.complete) {
276608
276608
  const ctx = context.ctx;
276609
276609
  ctx.save();
276610
- this.transformation.matrix.applyToContext(ctx);
276611
- ctx.drawImage(this.backgroundImage, 0, 0, this.getWidth(), this.getHeight());
276610
+ ctx.drawImage(this.backgroundImage, this.left, this.top, this.getWidth(), this.getHeight());
276612
276611
  ctx.restore();
276613
276612
  }
276614
276613
  this.path.render(context);
@@ -374984,6 +374983,19 @@ function GetCard({ cardPosition, rounded = "none" }) {
374984
374983
 
374985
374984
  // src/features/ContextPanel/Buttons/CardGame/Card/CreateDeck.tsx
374986
374985
  var import_react285 = __toESM(require_react(), 1);
374986
+ function sortItemsByPosition(items) {
374987
+ return items.sort((a9, b16) => {
374988
+ if (a9.top < b16.top)
374989
+ return -1;
374990
+ if (a9.top > b16.top)
374991
+ return 1;
374992
+ if (a9.left < b16.left)
374993
+ return -1;
374994
+ if (a9.left > b16.left)
374995
+ return 1;
374996
+ return 0;
374997
+ });
374998
+ }
374987
374999
  function CreateDeck({ rounded = "none", onlyCards }) {
374988
375000
  const { board } = useAppContext();
374989
375001
  const { t: t10 } = useTranslation();
@@ -374991,7 +375003,7 @@ function CreateDeck({ rounded = "none", onlyCards }) {
374991
375003
  if (single && single.itemType === "Deck") {
374992
375004
  return null;
374993
375005
  }
374994
- const cardsOrDecks = board.selection.items.list();
375006
+ const cardsOrDecks = sortItemsByPosition(board.selection.items.list());
374995
375007
  const handleClick = () => {
374996
375008
  if (onlyCards) {
374997
375009
  const deck = new Deck(board, "");
@@ -374999,8 +375011,8 @@ function CreateDeck({ rounded = "none", onlyCards }) {
374999
375011
  class: "Transformation",
375000
375012
  method: "translateTo",
375001
375013
  item: [deck.getId()],
375002
- x: cardsOrDecks[cardsOrDecks.length - 1].left,
375003
- y: cardsOrDecks[cardsOrDecks.length - 1].top
375014
+ x: cardsOrDecks[0].left,
375015
+ y: cardsOrDecks[0].top
375004
375016
  });
375005
375017
  const addedDeck = board.add(deck);
375006
375018
  board.selection.items.removeAll();
@@ -375014,9 +375026,8 @@ function CreateDeck({ rounded = "none", onlyCards }) {
375014
375026
  cards.push(item);
375015
375027
  } else if (item.itemType === "Deck") {
375016
375028
  if (mainDeck) {
375017
- cards.push(...mainDeck.getDeck());
375018
- board.remove(mainDeck);
375019
- mainDeck = item;
375029
+ cards.push(...item.getDeck());
375030
+ board.remove(item);
375020
375031
  } else {
375021
375032
  mainDeck = item;
375022
375033
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.135",
3
+ "version": "0.1.137",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -66,7 +66,7 @@
66
66
  "i18next-browser-languagedetector": "^8.2.0",
67
67
  "js-cookie": "^3.0.5",
68
68
  "jwt-decode": "^4.0.0",
69
- "microboard-temp": "^0.5.59",
69
+ "microboard-temp": "^0.5.60",
70
70
  "nanoid": "^5.1.5",
71
71
  "prop-types": "^15.8.1",
72
72
  "react-hot-toast": "2.4.1",