#Hey everyone I have a cool resizing
1 messages · Page 1 of 1 (latest)
Updated to close the dialog on selection, and to work for all currently selected tokens at once:
const sizes = {
tiny: {label:"Minúsculo", width:1, height:1, scale:0.55},
small: {label:"Pequeno", width:1, height:1, scale:0.75},
medium: {label:"Médio", width:1, height:1, scale:1},
large: {label:"Grande", width:2, height:2, scale:1},
huge: {label:"Enorme", width:3, height:3, scale:1},
gargantuan: {label:"Imenso", width:4, height:4, scale:1},
colossal: {label:"Colossal", width:5, height:5, scale:1}
};
var buttons = {};
for (const size in sizes) {
const val = sizes[size];
if (!sizes.hasOwnProperty(size)) {
continue;
}
buttons[size] = {
label: val.label,
callback: async () => {
const tokens = canvas.tokens.controlled;
if (!tokens || !tokens.length) {
return;
}
const updates = tokens.map(t => ({
_id: t.id,
width: val.width,
height: val.height,
scale: val.scale
}));
canvas.scene.updateEmbeddedDocuments("Token", updates);
}
};
}
buttons["close"] = {
icon: "<i class='fas fa-tick'></i>",
label: "Exit"
};
let dialogEditor = new Dialog({
title: "Selecionar tamanho",
buttons: buttons,
default: "close",
close: () => {}
});
dialogEditor.render(true)
@boreal monolith Hope this helps!
Thanks! Sorry about the very late reply, I just remembered today I had put this code here after resizing about 15 tokens one by one