mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +00:00
🔷 refactor context menu to accept context src
🔷 add a getCurrentDate function to get formatted date
This commit is contained in:
+11
-4
@@ -1,23 +1,30 @@
|
||||
import { defineStore } from "pinia";
|
||||
import normalize from "../composables/normalizeContextMenu";
|
||||
import { Option } from "../interfaces";
|
||||
import { ContextSrc } from "../composables/enums";
|
||||
|
||||
export default defineStore("context-menu", {
|
||||
state: () => ({
|
||||
visible: false,
|
||||
options: Array<Option>(),
|
||||
options: <Option[]>[],
|
||||
x: 500,
|
||||
y: 500,
|
||||
normalizedX: false,
|
||||
normalizedY: false,
|
||||
src: "",
|
||||
}),
|
||||
actions: {
|
||||
showContextMenu(e: any, context_options: Promise<Option[]>) {
|
||||
showContextMenu(
|
||||
e: any,
|
||||
context_options: Promise<Option[]>,
|
||||
src: ContextSrc
|
||||
) {
|
||||
if (this.visible) {
|
||||
this.visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.visible = true;
|
||||
context_options.then((options) => {
|
||||
this.options = options;
|
||||
});
|
||||
@@ -29,11 +36,11 @@ export default defineStore("context-menu", {
|
||||
|
||||
this.normalizedX = yo.normalizedX;
|
||||
this.normalizedY = yo.normalizedY;
|
||||
|
||||
this.visible = true;
|
||||
this.src = src;
|
||||
},
|
||||
hideContextMenu() {
|
||||
this.visible = false;
|
||||
this.src = null;
|
||||
},
|
||||
hasManyChildren() {
|
||||
let result = false;
|
||||
|
||||
Reference in New Issue
Block a user