All user data for FoundryVTT. Includes worlds, systems, modules, and any asset in the "foundryuserdata" directory. Does NOT include the FoundryVTT installation itself.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
1.1 KiB

export class TokenHandler{
static refreshTooltip(token) {
const hideElevation = CONFIG.Levels.settings.get("hideElevation");
if (hideElevation == 0) return;
if(hideElevation == 1 && game.user.isGM) return;
token.tooltip.text = "";
}
static setScale(token, renderFlags){
if(!CONFIG.Levels.settings.get("tokenElevScale") || !CONFIG.Levels.currentToken || token == CONFIG.Levels.currentToken) return;
const scaleMultiplier = CONFIG.Levels.settings.get("tokenElevScaleMultiSett");
const elevationDiff = Math.abs(token.document.elevation - CONFIG.Levels.currentToken.document.elevation) / 8;
//if(elevationDiff === 0) return;
const scaleFactor = elevationDiff == 0 ? 1 : Math.min(scaleMultiplier / elevationDiff, 1);
if(renderFlags.refreshMesh) token.mesh.originalScale = null;
if (!token.mesh.originalScale) {
token.mesh.originalScale = {x: token.mesh.scale.x, y: token.mesh.scale.y};
}
token.mesh.scale.x=token.mesh.originalScale.x*scaleFactor;
token.mesh.scale.y=token.mesh.originalScale.y*scaleFactor;
}
}