Added circle and rect outline options and optimised storage structure

This commit is contained in:
Mitchell McCaffrey
2021-04-25 17:10:32 +10:00
parent f7975c041a
commit 994b9b5ebb
4 changed files with 43 additions and 67 deletions

View File

@@ -179,13 +179,14 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
};
assets.push(fileAsset);
let outline = imageOutline(image).map(({ x, y }) => ({
x: x / image.width,
y: y / image.height,
}));
let outline = imageOutline(image);
if (outline.length > 100) {
outline = Vector2.resample(outline, 100);
}
// Flatten and round outline to save on storage size
outline = outline
.map(({ x, y }) => [Math.round(x), Math.round(y)])
.flat();
const token = {
name,