Changed token cache pixel ratio to use canvas ratio

This commit is contained in:
Mitchell McCaffrey 2021-01-02 09:49:52 +11:00
parent cc7db42894
commit 4adc6015f1

View File

@ -183,6 +183,9 @@ function MapToken({
const imageRef = useRef();
useEffect(() => {
const image = imageRef.current;
const canvas = image.getCanvas();
const pixelRatio = canvas.pixelRatio || 1;
if (
image &&
tokenSourceStatus === "loaded" &&
@ -190,7 +193,7 @@ function MapToken({
tokenHeight > 0
) {
image.cache({
pixelRatio: debouncedStageScale * window.devicePixelRatio,
pixelRatio: debouncedStageScale * pixelRatio,
});
image.drawHitFromCache();
// Force redraw