Update MapToken.js
This commit is contained in:
parent
aedc9548dd
commit
2311bf2b5b
@ -183,15 +183,14 @@ function MapToken({
|
|||||||
const imageRef = useRef();
|
const imageRef = useRef();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const image = imageRef.current;
|
const image = imageRef.current;
|
||||||
|
if (!image) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const canvas = image.getCanvas();
|
const canvas = image.getCanvas();
|
||||||
const pixelRatio = canvas.pixelRatio || 1;
|
const pixelRatio = canvas.pixelRatio || 1;
|
||||||
|
|
||||||
if (
|
if (tokenSourceStatus === "loaded" && tokenWidth > 0 && tokenHeight > 0) {
|
||||||
image &&
|
|
||||||
tokenSourceStatus === "loaded" &&
|
|
||||||
tokenWidth > 0 &&
|
|
||||||
tokenHeight > 0
|
|
||||||
) {
|
|
||||||
const maxImageSize = token ? Math.max(token.width, token.height) : 512; // Default to 512px
|
const maxImageSize = token ? Math.max(token.width, token.height) : 512; // Default to 512px
|
||||||
const maxTokenSize = Math.max(tokenWidth, tokenHeight);
|
const maxTokenSize = Math.max(tokenWidth, tokenHeight);
|
||||||
// Constrain image buffer to original image size
|
// Constrain image buffer to original image size
|
||||||
|
Loading…
Reference in New Issue
Block a user