|
10 | 10 | existing.has(`${x},${y}`) || |
11 | 11 | x < 0 |
12 | 12 | ) { |
13 | | - x = Math.floor(Math.random() * 8); |
| 13 | + x = Math.floor(Math.random() * 12); |
14 | 14 | y = Math.floor(Math.random() * 8); |
15 | 15 | } |
16 | 16 | existing.add(`${x},${y}`); |
|
59 | 59 |
|
60 | 60 | <!-- https://stackoverflow.com/questions/21368410/how-to-set-svg-width-and-svg-height-by-percent --> |
61 | 61 |
|
62 | | -<svg width="100%" height="auto" viewBox="0 0 832 832" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin:auto;"> |
| 62 | +<svg viewBox="0 0 1472 832" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block; margin:auto; height=auto; width=95%"> |
63 | 63 |
|
64 | 64 | <!-- Circle Generation --> |
65 | | - {#each Array(8) as _, i} |
| 65 | + {#each Array(12) as _, i} |
66 | 66 | {#each Array(8) as _, j} |
67 | 67 | {#if isTaken(i, j)} |
68 | 68 | <!-- Contributor Jellyfish --> |
69 | 69 | <image href="/1st/assets/jellyfish.png" width="128" height="128" |
70 | | - x={i * 96+Math.floor(Math.random() * 16)} |
71 | | - y={j * 96+Math.floor(Math.random() * 16)} |
| 70 | + x={i * 112+48+Math.floor(Math.random() * 16)} |
| 71 | + y={j * 96+8+Math.floor(Math.random() * 16)} |
72 | 72 | on:mouseover={() => showHover(i, j)} |
73 | 73 | on:mouseout={hideHover} |
74 | 74 | on:click={() => { |
|
77 | 77 | /> |
78 | 78 | {:else} |
79 | 79 | <!-- Default Circle --> |
80 | | - <!-- <circle cx={i * 96+64} cy={j * 96+64} r="16" fill="#FFFFFF" /> --> |
| 80 | + <!-- <circle cx={i * 112+64+48} cy={j * 96+64+8} r="16" fill="#FFFFFF" /> --> |
81 | 81 | {/if} |
82 | 82 | {/each} |
83 | 83 | {/each} |
|
86 | 86 | <!-- Hover Box --> |
87 | 87 | {#if hovered.name} |
88 | 88 | <rect |
89 | | - x={hovered.x * 96 + 48 - (hovered.name.length * 7)} |
| 89 | + x={hovered.x * 112 + 96 - (hovered.name.length * 7)} |
90 | 90 | y={hovered.y * 96} |
91 | 91 | width={hovered.name.length * 14} |
92 | 92 | height="28" |
|
95 | 95 | rx="4" |
96 | 96 | /> |
97 | 97 | <text |
98 | | - x={hovered.x * 96 + 48} |
| 98 | + x={hovered.x * 112 + 96} |
99 | 99 | y={hovered.y * 96 + 16} |
100 | 100 | font-size="16" |
101 | 101 | fill="#FFFFFE" |
|
108 | 108 | {/if} |
109 | 109 |
|
110 | 110 | </svg> |
111 | | - |
112 | | -<style> |
113 | | - svg { |
114 | | - user-select: none; |
115 | | - width: min(100%, 600px); |
116 | | - } |
117 | | -</style> |
0 commit comments