From 79cef3b3029b86d18075f1f1dd366e0e473644f6 Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Mon, 11 Sep 2023 08:42:08 -0500 Subject: [PATCH] Ensure dice rolled in pane if autodisplay is empty (#242) --- src/view/view.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/view/view.ts b/src/view/view.ts index f4eeabf..a45646d 100644 --- a/src/view/view.ts +++ b/src/view/view.ts @@ -12,6 +12,8 @@ import { import DiceRollerPlugin from "src/main"; import { StackRoller } from "src/roller"; import { COPY_DEFINITION, ICON_DEFINITION } from "src/utils/constants"; +import { ExpectedValue, RollerOptions } from "../types"; +import API from "../api/api"; export const VIEW_TYPE = "DICE_ROLLER_VIEW"; @@ -238,7 +240,11 @@ export default class DiceView extends ItemView { return; } this.rollButton.setDisabled(true); - const roller = await this.plugin.getRoller(formula, "view"); + const opts: RollerOptions = {...API.RollerOptions(this.plugin)}; + if (opts.expectedValue == ExpectedValue.None) { + opts.expectedValue = ExpectedValue.Roll; + } + const roller = await this.plugin.getRoller(formula, "view", opts); if (!(roller instanceof StackRoller)) { new Notice("The Dice View only supports dice rolls.");