Adjust token attachment size to be resolution independent

This commit is contained in:
Mitchell McCaffrey 2021-08-06 08:34:27 +10:00
parent b300418d78
commit afd9f2d30a

View File

@ -13,27 +13,29 @@ function TokenAttachment({
highlight,
radius,
}: TokenAttachmentProps) {
const width = radius / 3;
const height = radius / 8;
return (
<Group>
{/* Make a bigger hidden rect for hit registration */}
<Rect
width={10}
height={5}
x={-5}
y={tokenHeight / 2 - 2.5}
width={width * 2}
height={height * 2}
x={-width}
y={tokenHeight / 2 - height}
cornerRadius={2.5}
fill="transparent"
/>
<Rect
width={5}
height={2}
x={-2.5}
y={tokenHeight / 2 - 1}
width={width}
height={height}
x={-width / 2}
y={tokenHeight / 2 - height / 2}
cornerRadius={2.5}
fill="rgba(36, 39, 51, 0.5)"
shadowColor="rgba(0,0,0,0.12)"
shadowOffsetY={1}
shadowBlur={2}
fill="rgba(36, 39, 51, 0.8)"
shadowColor="rgba(0,0,0,0.5)"
shadowOffsetY={radius / 40}
shadowBlur={radius / 15}
hitFunc={() => {}}
/>
{dragging ? (