Added a limited scale to token label size based off of token size

This commit is contained in:
Mitchell McCaffrey 2020-07-20 19:30:09 +10:00
parent 58ac649aa8
commit 7204109c7d

View File

@ -1,10 +1,15 @@
import React, { useRef, useEffect, useState } from "react";
import { Rect, Text, Group } from "react-konva";
const maxTokenSize = 3;
function TokenLabel({ tokenState, width, height }) {
const fontSize = height / 6 / tokenState.size;
const paddingY = height / 16 / tokenState.size;
const paddingX = height / 8 / tokenState.size;
const fontSize =
(height / 6 / tokenState.size) * Math.min(tokenState.size, maxTokenSize);
const paddingY =
(height / 16 / tokenState.size) * Math.min(tokenState.size, maxTokenSize);
const paddingX =
(height / 8 / tokenState.size) * Math.min(tokenState.size, maxTokenSize);
const [rectWidth, setRectWidth] = useState(0);
useEffect(() => {