Added token rotation

This commit is contained in:
Mitchell McCaffrey
2020-05-22 21:10:05 +10:00
parent a8bd5ab672
commit ef1c875088
3 changed files with 40 additions and 11 deletions

View File

@@ -178,7 +178,7 @@ function MapToken({
onDragEnd={handleDragEnd}
onDragStart={handleDragStart}
opacity={tokenOpacity}
name={token.isVehicle ? "vehicle" : "token"}
name={token && token.isVehicle ? "vehicle" : "token"}
id={tokenState.id}
>
<KonvaImage
@@ -188,17 +188,22 @@ function MapToken({
x={0}
y={0}
image={tokenSourceImage}
rotation={tokenState.rotation}
offsetX={tokenWidth / 2}
offsetY={tokenHeight / 2}
/>
<TokenStatus
tokenState={tokenState}
width={tokenWidth}
height={tokenHeight}
/>
<TokenLabel
tokenState={tokenState}
width={tokenWidth}
height={tokenHeight}
/>
<Group offsetX={tokenWidth / 2} offsetY={tokenHeight / 2}>
<TokenStatus
tokenState={tokenState}
width={tokenWidth}
height={tokenHeight}
/>
<TokenLabel
tokenState={tokenState}
width={tokenWidth}
height={tokenHeight}
/>
</Group>
</Group>
);
}