From f14143d058c6a3b8ec14ec287032ebdb659b04f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Michelle?= Date: Thu, 19 Mar 2026 14:40:15 +0100 Subject: [PATCH] updates sample-zone --- .../src/ui/devices/ScriptDeviceEditor.sass | 47 +++++++------------ .../src/ui/devices/ScriptDeviceEditor.tsx | 27 ++++++++--- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/packages/app/studio/src/ui/devices/ScriptDeviceEditor.sass b/packages/app/studio/src/ui/devices/ScriptDeviceEditor.sass index 67ba8014..6ff4c22b 100644 --- a/packages/app/studio/src/ui/devices/ScriptDeviceEditor.sass +++ b/packages/app/studio/src/ui/devices/ScriptDeviceEditor.sass @@ -28,50 +28,37 @@ component color: orange cursor: default - div.sample-drop + .sample-drop + margin-top: 1px + scale: 0.8 border-radius: 50% color: var(--color-shadow) display: flex - flex-direction: column align-items: center justify-content: center outline: 1px dashed rgba(white, 0.1) - margin: 0.5em - position: relative + aspect-ratio: 1 cursor: pointer pointer-events: all > svg - width: 1em - height: 1em - pointer-events: none - - > span - text-align: center - width: 75% - overflow: hidden - text-overflow: ellipsis - font-size: 0.5em + width: 1.5em + height: 1.5em pointer-events: none &[sample] color: var(--color-blue) - - &:after - content: attr(sample) - font-size: 0.5em - white-space: nowrap - text-overflow: ellipsis - overflow: hidden - position: absolute - bottom: -1em - width: 100% - text-align: center - padding: 1px 2px - border-radius: 3px - color: black - background-color: var(--color-blue) + outline-color: var(--color-blue) &.accept color: var(--color-black) - background-color: var(--color-blue) \ No newline at end of file + background-color: var(--color-blue) + + .sample-name + width: 100% + font-size: 0.5em + text-align: center + white-space: nowrap + text-overflow: ellipsis + overflow: hidden + color: var(--color-gray) \ No newline at end of file diff --git a/packages/app/studio/src/ui/devices/ScriptDeviceEditor.tsx b/packages/app/studio/src/ui/devices/ScriptDeviceEditor.tsx index bebc0217..dfc2de33 100644 --- a/packages/app/studio/src/ui/devices/ScriptDeviceEditor.tsx +++ b/packages/app/studio/src/ui/devices/ScriptDeviceEditor.tsx @@ -192,10 +192,10 @@ export const ScriptDeviceEditor = ({lifecycle, service, adapter, deviceHost, con const sample = asInstanceOf(sampleBox, WerkstattSampleBox) const label = sample.label.getValue() const terminator = new Terminator() + const fileNameLabel: HTMLSpanElement = () const dropZone: HTMLElement = (
- {label}
) const sampleSelector = new SampleSelector(service, { @@ -211,18 +211,31 @@ export const ScriptDeviceEditor = ({lifecycle, service, adapter, deviceHost, con }) terminator.ownAll( sample.file.catchupAndSubscribe(pointer => pointer.targetVertex.match({ - none: () => dropZone.removeAttribute("sample"), - some: ({box: fileBox}) => - dropZone.setAttribute("sample", asInstanceOf(fileBox, AudioFileBox).fileName.getValue()) + none: () => { + dropZone.removeAttribute("sample") + fileNameLabel.textContent = "" + }, + some: ({box: fileBox}) => { + const name = asInstanceOf(fileBox, AudioFileBox).fileName.getValue() + dropZone.setAttribute("sample", name) + fileNameLabel.textContent = name + } })), sampleSelector.configureBrowseClick(dropZone), sampleSelector.configureContextMenu(dropZone), sampleSelector.configureDrop(dropZone) ) - dropZone.style.order = String(sample.index.getValue()) + const element: HTMLElement = ( + +
{label}
+ {dropZone} + {fileNameLabel} +
+ ) + element.style.order = String(sample.index.getValue()) terminator.own(sample.index.catchupAndSubscribe(owner => - dropZone.style.order = String(owner.getValue()))) - controls.appendChild(dropZone) + element.style.order = String(owner.getValue()))) + controls.appendChild(element) set.add({uuid: sampleBox.address.uuid, lifecycle: terminator}) terminator.own({terminate: () => dropZone.remove()}) },