Added fallback for token without size
This commit is contained in:
parent
852d5bce81
commit
037e4a4ab4
@ -430,7 +430,7 @@ function MapFog({
|
|||||||
|
|
||||||
// Constrain fog buffer to the map resolution
|
// Constrain fog buffer to the map resolution
|
||||||
const fogRect = fogGroup.getClientRect();
|
const fogRect = fogGroup.getClientRect();
|
||||||
const maxMapSize = Math.max(map.width, map.height);
|
const maxMapSize = map ? Math.max(map.width, map.height) : 4096; // Default to 4096
|
||||||
const maxFogSize =
|
const maxFogSize =
|
||||||
Math.max(fogRect.width, fogRect.height) / debouncedStageScale;
|
Math.max(fogRect.width, fogRect.height) / debouncedStageScale;
|
||||||
const maxPixelRatio = maxMapSize / maxFogSize;
|
const maxPixelRatio = maxMapSize / maxFogSize;
|
||||||
|
@ -192,7 +192,7 @@ function MapToken({
|
|||||||
tokenWidth > 0 &&
|
tokenWidth > 0 &&
|
||||||
tokenHeight > 0
|
tokenHeight > 0
|
||||||
) {
|
) {
|
||||||
const maxImageSize = Math.max(token.width, token.height);
|
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
|
||||||
const maxRatio = maxImageSize / maxTokenSize;
|
const maxRatio = maxImageSize / maxTokenSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user