Skip to content

Commit

Permalink
feat: Table blocks have optional calculate property to turn off mod…
Browse files Browse the repository at this point in the history
…ifier calculation (#30)
  • Loading branch information
valentine195 committed Jan 13, 2022
1 parent 137566a commit fce05c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/settings/ui/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,18 @@ export class BlockModal extends Modal {
...(e.detail?.map((v) => v.name) ?? [])
];
});
/* for (const property of this.block.headers) {
const header = additional.createDiv("header-container");
header.createSpan({ text: property });
new ExtraButtonComponent(header.createDiv())
.setIcon("cross-in-box")
.onClick(() => {
(this.block as TableItem).headers = (
this.block as TableItem
).headers.filter((v) => v != property);
this.buildProperties(el);
new Setting(el)
.setName("Calculate Modifiers")
.setDesc(
"The block will not attempt to calculate modifiers for table values."
)
.addToggle((t) => {
t.setValue(
(this.block as TableItem).calculate
).onChange((v) => {
(this.block as TableItem).calculate = v;
});
} */
});
}
if (!this.advanced) return;
if (this.block.type == "text") {
Expand Down Expand Up @@ -314,7 +314,7 @@ export class BlockModal extends Modal {
this.display();
});
});

this.buildProperties(this.contentEl.createDiv());
this.buildConditions(this.contentEl.createDiv());
this.buildDice(this.contentEl.createDiv());
Expand Down
15 changes: 11 additions & 4 deletions src/view/ui/Table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
<div class="table">
{#each values.slice(0, headers.length) as value, index}
<div class="table-item">
<span class="statblock-table-header"
>{`${headers[index]}`.toUpperCase()}</span
>
<span>{value} ({getMod(value)}) </span>
<span class="statblock-table-header">
{`${headers[index]}`.toUpperCase()}
</span>
<span>
{value}
{#if item.calculate}
<span>
({getMod(value)})
</span>
{/if}
</span>
</div>
{/each}
</div>
Expand Down

0 comments on commit fce05c6

Please sign in to comment.