@@ -37,12 +38,13 @@ const isDragOver = ref(false)
const isFirstDrag = ref(true)
const isLoadingTrack = ref(false)
const isPlaying = ref(false)
-
-const coverUrl = computed(() => props.track?.coverId || '/card-dock.svg')
+const coverUrl = computed(() => currentTrack.value?.coverId || '/card-dock.svg')
let disc: Disc | null = null
let sampler: Sampler | null = null
+const currentTrack = ref()
+
const updateTurns = (disc: Disc) => {
currentTurns.value = disc.secondsPlayed * 0.75 // 0.75 tours par seconde (RPS)
totalTurns.value = (disc as any)._duration * 0.75 // Accès à la propriété _duration privée
@@ -50,7 +52,7 @@ const updateTurns = (disc: Disc) => {
};
const startPlayback = () => {
- if (!disc || !sampler || !props.track || isPlaying.value) return
+ if (!disc || !sampler || !currentTrack.value || isPlaying.value) return
isPlaying.value = true
sampler.play(disc.secondsPlayed)
@@ -58,7 +60,7 @@ const startPlayback = () => {
}
const togglePlay = () => {
- if (!disc || !sampler || !props.track) return
+ if (!disc || !sampler || !currentTrack.value) return
isPlaying.value = !isPlaying.value
@@ -75,27 +77,19 @@ const toggleMute = () => {
sampler.mute()
}
-const handleRewind = () => {
- if (!disc || !sampler || !props.track) return
-
- sampler.pause()
- disc.rewind()
- if (isPlaying.value) {
- sampler.play(0)
- }
-};
-
const loadTrack = async (track: Track) => {
if (!sampler || !track) return
+ currentTrack.value = track
isLoadingTrack.value = true
try {
- await sampler.loadTrack(track.url)
+ await sampler.loadTrack(currentTrack.value.url)
if (disc) {
disc.setDuration(sampler.duration)
updateTurns(disc)
+ sampler.play(0)
+ disc.secondsPlayed = 0
disc.powerOn()
- disc.powerOff()
}
} finally {
isLoadingTrack.value = false
@@ -134,6 +128,7 @@ const onDrop = (e: DragEvent) => {
const newTrack = JSON.parse(cardData)
if (newTrack && newTrack.url) {
loadTrack(newTrack)
+ disc?.powerOn()
}
} catch (error) {
console.error('Erreur lors du traitement de la carte déposée', error)
@@ -175,9 +170,9 @@ onMounted(async () => {
})
-watch(() => props.track, (newTrack) => {
- if (newTrack) {
- loadTrack(newTrack)
+watch(() => props.track, (propTrack) => {
+ if (propTrack) {
+ loadTrack(propTrack)
}
})
@@ -199,6 +194,14 @@ onUnmounted(() => {
width: 100%;
height: 100%;
padding: 20px;
+
+ .card {
+ position: absolute !important;
+ z-index: 99;
+ left: 50%;
+ bottom: 0;
+ transform: translate(-50%, 50%);
+ }
}
.disc {
diff --git a/app/components/deck/Playlist.vue b/app/components/deck/Playlist.vue
index d743e8c..178358a 100644
--- a/app/components/deck/Playlist.vue
+++ b/app/components/deck/Playlist.vue
@@ -6,9 +6,6 @@
-
@@ -17,10 +14,6 @@
-
+
+
\ No newline at end of file
diff --git a/app/components/draggable.vue b/app/components/draggable.vue
deleted file mode 100644
index 1698a1b..0000000
--- a/app/components/draggable.vue
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/ui/Draggable.vue b/app/components/ui/Draggable.vue
new file mode 100644
index 0000000..7fd1551
--- /dev/null
+++ b/app/components/ui/Draggable.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/components/ui/Droppable.vue b/app/components/ui/Droppable.vue
new file mode 100644
index 0000000..eaa9c34
--- /dev/null
+++ b/app/components/ui/Droppable.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index ba4672f..6c5738b 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -1,3 +1,32 @@
+
+
+
+
+
+
diff --git a/app/pages/index.vue b/app/pages/index.vue
index ccd8597..a92d3f7 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -1,4 +1,4 @@
-
+
diff --git a/app/plugins/shortcut.client.ts b/app/plugins/shortcut.client.ts
index e919262..97e2f47 100644
--- a/app/plugins/shortcut.client.ts
+++ b/app/plugins/shortcut.client.ts
@@ -83,15 +83,6 @@ export default defineNuxtPlugin((nuxtApp) => {
ui.closeBox()
break
- // Gestion de la touche Entrée pour ouvrir une boîte
- case 'Enter':
- if (document.activeElement?.id) {
- e.preventDefault()
- ui.selectBox(document.activeElement.id)
- window.scrollTo({ top: 0, behavior: 'smooth' })
- }
- break
-
// Gestion des touches fléchées (à implémenter si nécessaire)
case 'ArrowUp':
case 'ArrowDown':