Add a context menu to the photo slot (closes #146)

This commit is contained in:
Oliver-Akins 2024-03-30 22:52:45 -06:00
parent e54857023b
commit 3a5a3ecc38
2 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import { GenericContextMenu } from "../../utils/GenericContextMenu.mjs";
import { GenericItemSheet } from "./GenericItemSheet.mjs"; import { GenericItemSheet } from "./GenericItemSheet.mjs";
export class UntypedItemSheet extends GenericItemSheet { export class UntypedItemSheet extends GenericItemSheet {
@ -22,6 +23,28 @@ export class UntypedItemSheet extends GenericItemSheet {
return opts; 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() { async getData() {
const ctx = await super.getData(); const ctx = await super.getData();

View file

@ -1,7 +1,7 @@
@use "../mixins/material" as material; @use "../mixins/material" as material;
.dotdungeon.style-v3 > .window-content { .dotdungeon.style-v3 > .window-content {
nav { nav:not(#context-menu) {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
overflow-x: auto; overflow-x: auto;