From 3a5a3ecc383a634d46697f11a8e40416a5517261 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 30 Mar 2024 22:52:45 -0600 Subject: [PATCH] Add a context menu to the photo slot (closes #146) --- module/sheets/Items/UntypedItemSheet.mjs | 23 +++++++++++++++++++++++ styles/v3/elements/nav.scss | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/module/sheets/Items/UntypedItemSheet.mjs b/module/sheets/Items/UntypedItemSheet.mjs index 891680e..83dd96b 100644 --- a/module/sheets/Items/UntypedItemSheet.mjs +++ b/module/sheets/Items/UntypedItemSheet.mjs @@ -1,3 +1,4 @@ +import { GenericContextMenu } from "../../utils/GenericContextMenu.mjs"; import { GenericItemSheet } from "./GenericItemSheet.mjs"; export class UntypedItemSheet extends GenericItemSheet { @@ -22,6 +23,28 @@ export class UntypedItemSheet extends GenericItemSheet { return opts; }; + activateListeners(html) { + super.activateListeners(html); + + if (!this.isEditable) return; + console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`); + + new GenericContextMenu(html, `.photo.panel`, [ + { + name: `View Larger`, + callback: (html) => { + console.log(`.dungeon | View Larger`); + }, + }, + { + name: `Change Photo`, + callback: (html) => { + console.log(`.dungeon | Change Photo`); + }, + }, + ]); + }; + async getData() { const ctx = await super.getData(); diff --git a/styles/v3/elements/nav.scss b/styles/v3/elements/nav.scss index b1bb248..6046e41 100644 --- a/styles/v3/elements/nav.scss +++ b/styles/v3/elements/nav.scss @@ -1,7 +1,7 @@ @use "../mixins/material" as material; .dotdungeon.style-v3 > .window-content { - nav { + nav:not(#context-menu) { display: flex; flex-direction: row; overflow-x: auto;