diff options
author | mat <github@matdoes.dev> | 2022-05-17 18:50:49 +0000 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-05-17 18:50:49 +0000 |
commit | f9bb90cab81e7c7f8c2a7e932bbf2ddbf7b51f1f (patch) | |
tree | bc8d05a884632dcd64f6a76a40dc6174e7549d56 /src/lib | |
parent | b6d23f4334eae873e7d32a4d5bb5f8b3a1a67ce5 (diff) | |
download | skyblock-stats-f9bb90cab81e7c7f8c2a7e932bbf2ddbf7b51f1f.tar.gz skyblock-stats-f9bb90cab81e7c7f8c2a7e932bbf2ddbf7b51f1f.tar.bz2 skyblock-stats-f9bb90cab81e7c7f8c2a7e932bbf2ddbf7b51f1f.zip |
auction search and fixes
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/AuctionPreviewTooltip.svelte | 4 | ||||
-rw-r--r-- | src/lib/AuctionPriceScatterplot.svelte | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/AuctionPreviewTooltip.svelte b/src/lib/AuctionPreviewTooltip.svelte index 223cec2..417f8b3 100644 --- a/src/lib/AuctionPreviewTooltip.svelte +++ b/src/lib/AuctionPreviewTooltip.svelte @@ -5,7 +5,7 @@ import type { PreviewedAuctionData } from './utils' export let preview: PreviewedAuctionData | null - export let lastPreview: PreviewedAuctionData | null + let lastPreview: PreviewedAuctionData | null $: lastPreview = preview ?? lastPreview @@ -36,7 +36,7 @@ #auction-preview-tooltip { position: absolute; border: 1px solid rgba(255, 255, 255, 0.1); - background: var(--theme-lighter-background); + background: rgba(0, 0, 0, 0.1); padding: 0.5em; transition: left 200ms, top 200ms; pointer-events: none; diff --git a/src/lib/AuctionPriceScatterplot.svelte b/src/lib/AuctionPriceScatterplot.svelte index 48a3fa5..1e774d0 100644 --- a/src/lib/AuctionPriceScatterplot.svelte +++ b/src/lib/AuctionPriceScatterplot.svelte @@ -25,7 +25,11 @@ let nearestDistance = Number.MAX_SAFE_INTEGER let nearestAuction: SimpleAuctionSchema | null = null for (const auction of item.auctions) { - const auctionCoords = getAuctionCoordinates(auction) + const auctionCoordsSvg = getAuctionCoordinates(auction) + const auctionCoords = [ + (auctionCoordsSvg[0] * rect.width) / 100, + (auctionCoordsSvg[1] * rect.height) / 100, + ] const distance = Math.pow(mouseCoords[0] - auctionCoords[0], 2) + Math.pow(mouseCoords[1] - auctionCoords[1], 2) @@ -35,7 +39,8 @@ } } if (nearestAuction) { - const [x, y] = getAuctionCoordinates(nearestAuction) + const [svgX, svgY] = getAuctionCoordinates(nearestAuction) + const [x, y] = [(svgX * rect.width) / 100, (svgY * rect.height) / 100] currentlyPreviewedAuction = { pageX: window.scrollX + rect.left + x, pageY: window.scrollY + rect.top + y, @@ -67,7 +72,7 @@ r="1" stroke-width="4" fill={auction.bin ? '#11b' : '#1b1'} - tabindex="-1" + class:selected-auction={currentlyPreviewedAuction?.auction?.id === auction?.id} /> {/each} <!-- {item.auctions} --> @@ -78,4 +83,8 @@ height: 10em; width: 100%; } + + .selected-auction { + stroke: #06e7; + } </style> |