This commit is contained in:
2024-03-31 14:56:26 +02:00
parent ebca41dc8f
commit 3c9065ee8c
25 changed files with 49 additions and 29 deletions

View File

@@ -1,6 +1,7 @@
{ {
"name": "arne-drums", "name": "arne-drums",
"version": "1.0.0", "version": "1.0.0",
"type": "module",
"description": "Drum beat visualiser and editor", "description": "Drum beat visualiser and editor",
"main": "src/main.ts", "main": "src/main.ts",
"scripts": { "scripts": {

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

View File

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 427 B

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View File

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

View File

@@ -2,8 +2,15 @@
<div class="beat" :class="{ vertical: false }"> <div class="beat" :class="{ vertical: false }">
<editable-text-field node-type="h3" class="beat-title" v-model="beat!.name.value" /> <editable-text-field node-type="h3" class="beat-title" v-model="beat!.name.value" />
<div class="beat-main-container"> <div class="beat-main-container">
<div class="beat-track-container"> <div class="beat-track-container" :class="{ dragging }">
<draggable handle=".handle" :list="tracks" @change="onMove" item-key="index"> <draggable @start="dragging = true"
@end="dragging = false"
animation="150"
ghost-class="ghost"
handle=".handle"
:list="tracks"
@change="onMove"
item-key="index">
<template #item="{ element }"> <template #item="{ element }">
<div class="beat-line"> <div class="beat-line">
<editable-text-field class="track-name" v-model="element.track.name.value" /> <editable-text-field class="track-name" v-model="element.track.name.value" />
@@ -23,10 +30,10 @@
import EditableTextField from "@/ui/Widgets/EditableTextField/EditableTextField.vue"; import EditableTextField from "@/ui/Widgets/EditableTextField/EditableTextField.vue";
import { useAppStateStore } from '@/AppState'; import { useAppStateStore } from '@/AppState';
import { useBeatStore } from '@/BeatStore'; import { useBeatStore } from '@/BeatStore';
import { computed } from "vue"; import { computed, ref } from "vue";
import Draggable from "vuedraggable"; import Draggable from "vuedraggable";
import type { Track } from "@/Track"; import type { Track } from "@/Track";
import Icon from "../Widgets/Icon/Icon.vue"; import Icon from "@/ui/Widgets/Icon/Icon.vue";
const props = defineProps<{ const props = defineProps<{
beatIndex: number, beatIndex: number,
@@ -47,14 +54,16 @@
track: trackList[i]!, track: trackList[i]!,
}); });
} }
if (props.orientation === 'horizontal') { if (props.orientation !== 'horizontal') {
list.reverse(); list.reverse();
} }
return list; return list;
}); });
const dragging = ref(false);
function onMove(evt: { moved: { oldIndex: number, newIndex: number }}) { function onMove(evt: { moved: { oldIndex: number, newIndex: number }}) {
if (props.orientation === 'horizontal') { if (props.orientation !== 'horizontal') {
beat.value?.insertAt(tracks.value.length - 1 - evt.moved.oldIndex, tracks.value.length - 1 - evt.moved.newIndex); beat.value?.insertAt(tracks.value.length - 1 - evt.moved.oldIndex, tracks.value.length - 1 - evt.moved.newIndex);
} else { } else {
beat.value?.insertAt(evt.moved.oldIndex, evt.moved.newIndex); beat.value?.insertAt(evt.moved.oldIndex, evt.moved.newIndex);
@@ -154,10 +163,23 @@
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
}
.dragging {
:not(.ghost) {
.handle {
opacity: 0%;
}
}
} }
.track-name { .track-name {
text-align: right; text-align: right;
} }
.ghost {
opacity: 0;
}
</style> </style>

View File

@@ -161,6 +161,7 @@
height: 100vh; height: 100vh;
display: flex; display: flex;
transition: left 400ms; transition: left 400ms;
top: 0;
} }
&.sidebar-visible { &.sidebar-visible {
@@ -200,7 +201,6 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.buttons { .buttons {
flex: 1; flex: 1;
@@ -228,6 +228,7 @@
position: absolute; position: absolute;
height: 100%; height: 100%;
left: 0; left: 0;
top: 0;
width: 100vw; width: 100vw;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -32,8 +32,6 @@
const { beats } = useBeatStore(); const { beats } = useBeatStore();
const beat = computed(() => beats.value[props.beatIndex] ?? null); const beat = computed(() => beats.value[props.beatIndex] ?? null);
const track = computed(() => beat.value?.tracks.value[props.trackIndex] ?? null); const track = computed(() => beat.value?.tracks.value[props.trackIndex] ?? null);
watch(track, () => console.log(track.value));
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -15,7 +15,7 @@
const cssText = computed(() => { const cssText = computed(() => {
const colorString = props.color ? `--icon-bg:${ props.color }` : ""; const colorString = props.color ? `--icon-bg:${ props.color }` : "";
return `-webkit-mask-image: url(${ iconUrl.value }); mask-image: url(${ iconUrl.value });${ colorString ?? '' }`; return `-webkit-mask-image: url("${ iconUrl.value }"); mask-image: url("${ iconUrl.value }");${ colorString ?? '' }`;
}); });
</script> </script>

View File

@@ -1,13 +1,13 @@
import List from "assets/svgs/list.svg"; import List from "@/assets/svgs/list.svg";
import ArrowClockwise from "assets/svgs/arrow-clockwise.svg"; import ArrowClockwise from "@/assets/svgs/arrow-clockwise.svg";
import Trash from "assets/svgs/trash.svg"; import Trash from "@/assets/svgs/trash.svg";
import Snowflake from "assets/svgs/snowflake.svg"; import Snowflake from "@/assets/svgs/snowflake.svg";
import LeftHand from "assets/svgs/LH.png"; import LeftHand from "@/assets/svgs/LH.png";
import Download from "assets/svgs/download.svg"; import Download from "@/assets/svgs/download.svg";
import RightHand from "assets/svgs/RH.png"; import RightHand from "@/assets/svgs/RH.png";
import LeftFoot from "assets/svgs/LF.png"; import LeftFoot from "@/assets/svgs/LF.png";
import RightFoot from "assets/svgs/RF.png"; import RightFoot from "@/assets/svgs/RF.png";
import Eraser from "assets/svgs/eraser-fill.svg"; import Eraser from "@/assets/svgs/eraser-fill.svg";
export const IconUrlMap = { export const IconUrlMap = {
arrowClockwise: ArrowClockwise, arrowClockwise: ArrowClockwise,

View File

@@ -113,26 +113,26 @@ body {
font-family: 'DMSans'; font-family: 'DMSans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url(assets/fonts/DMSans-Regular.ttf) format('woff2'); src: url(@/assets/fonts/DMSans-Regular.ttf) format('woff2');
} }
@font-face { @font-face {
font-family: 'DMSans'; font-family: 'DMSans';
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
src: url(assets/fonts/DMSans-Bold.ttf) format('woff2'); src: url(@/assets/fonts/DMSans-Bold.ttf) format('woff2');
} }
@font-face { @font-face {
font-family: 'DMSans'; font-family: 'DMSans';
font-style: italic; font-style: italic;
font-weight: 400; font-weight: 400;
src: url(assets/fonts/DMSans-Italic.ttf) format('woff2'); src: url(@/assets/fonts/DMSans-Italic.ttf) format('woff2');
} }
@font-face { @font-face {
font-family: 'DMSans'; font-family: 'DMSans';
font-style: italic; font-style: italic;
font-weight: 600; font-weight: 600;
src: url(assets/fonts/DMSans-BoldItalic.ttf) format('woff2'); src: url(@/assets/fonts/DMSans-BoldItalic.ttf) format('woff2');
} }

View File

@@ -12,16 +12,14 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"@/*": ["src/*"], "@/*": ["src/*"]
"assets/*": ["assets/*"]
}, },
"jsxFactory": "h", "jsxFactory": "h",
"jsxFragmentFactory": "frag", "jsxFragmentFactory": "frag",
"jsx": "react" "jsx": "react"
}, },
"include": [ "include": [
"./src/**/*", "./src/**/*"
"./assets/**/*"
], ],
"references": [ "references": [
{ {

View File

@@ -11,9 +11,9 @@ export default defineConfig({
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)), '@': fileURLToPath(new URL('./src', import.meta.url)),
'assets': fileURLToPath(new URL('./assets', import.meta.url)),
} }
}, },
root: '.',
base: BASE_URL, base: BASE_URL,
build: { build: {
minify: !DEVELOPMENT, minify: !DEVELOPMENT,