card_thumb.svelte 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script lang="js">
  2. import { setLeftPanelCard, showMobileInfo } from '../left_panel';
  3. import { cardImageUrl } from '../utils';
  4. let {id, area, idx, limitNum} = $props();
  5. function onhover() {
  6. setLeftPanelCard(id);
  7. }
  8. function onDragStart(e) {
  9. e.dataTransfer.setData('text', JSON.stringify({id, area, idx}))
  10. }
  11. </script>
  12. {#if id}
  13. <img
  14. style="margin:2px;"
  15. draggable="true"
  16. onmouseover={onhover}
  17. onfocus={onhover}
  18. ondragstart={onDragStart}
  19. onclick={()=>{onhover();showMobileInfo();}}
  20. height="100%"
  21. src={cardImageUrl(id)}
  22. alt="yugioh card {id}"
  23. />
  24. {#if limitNum === 1 || limitNum == 2}
  25. <div class="overlay">{limitNum}</div>
  26. {:else if limitNum === 0}
  27. <div class="ban-overlay"></div>
  28. {/if}
  29. {/if}
  30. <style>
  31. .overlay {
  32. position: absolute;
  33. top: 0;
  34. left: 0;
  35. border: 3px solid red;
  36. border-radius: 50%;
  37. background-color: black;
  38. width: 20px;
  39. height: 20px;
  40. display: flex;
  41. align-items: center;
  42. justify-content: center;
  43. font-weight: bold;
  44. color: yellow;
  45. font-size: 15px;
  46. font-family: Arial, sans-serif;
  47. box-sizing: border-box;
  48. pointer-events: none;
  49. }
  50. .ban-overlay {
  51. position: absolute;
  52. top: 0;
  53. left: 0;
  54. border: 3px solid red;
  55. border-radius: 50%;
  56. background-color: black;
  57. width: 20px;
  58. height: 20px;
  59. display: flex;
  60. align-items: center;
  61. justify-content: center;
  62. font-weight: bold;
  63. color: yellow;
  64. font-size: 15px;
  65. font-family: Arial, sans-serif;
  66. box-sizing: border-box;
  67. pointer-events: none;
  68. }
  69. .ban-overlay::after {
  70. content: '';
  71. width: 15px;
  72. height: 3px;
  73. background-color: red;
  74. transform: rotate(45deg);
  75. position: absolute;
  76. pointer-events: none;
  77. }
  78. </style>