FIX: Device orientation setting
This commit is contained in:
@@ -58,7 +58,9 @@
|
|||||||
<MenubarSeparator />
|
<MenubarSeparator />
|
||||||
<MenubarItem class="flex justify-between" @click="deviceStore.cycleOrientation">
|
<MenubarItem class="flex justify-between" @click="deviceStore.cycleOrientation">
|
||||||
<p>Orientation: </p>
|
<p>Orientation: </p>
|
||||||
<p>{{ deviceStore.settings?.orientation || 0 }}°</p>
|
<p>
|
||||||
|
{{ deviceStore.orientationLabels[deviceStore.settings?.deviceOrientation || 0] }}°
|
||||||
|
</p>
|
||||||
<MenubarShortcut>⌘R</MenubarShortcut>
|
<MenubarShortcut>⌘R</MenubarShortcut>
|
||||||
</MenubarItem>
|
</MenubarItem>
|
||||||
<MenubarSeparator />
|
<MenubarSeparator />
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ export interface DeviceSettings {
|
|||||||
firmwareVersion: string
|
firmwareVersion: string
|
||||||
midiUsb: MidiSettings
|
midiUsb: MidiSettings
|
||||||
midi2: MidiSettings
|
midi2: MidiSettings
|
||||||
|
idleTimeout: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MidiSettings {
|
export interface MidiSettings {
|
||||||
@@ -142,7 +143,8 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
detentCount: 10,
|
detentCount: 10,
|
||||||
vernier: 10
|
vernier: 10
|
||||||
}
|
}
|
||||||
} as Value
|
} as Value,
|
||||||
|
orientationLabels: [0, 90, 180, 270]
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
connected: (state) => state.currentDeviceId !== null,
|
connected: (state) => state.currentDeviceId !== null,
|
||||||
@@ -336,7 +338,13 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
cycleOrientation() {
|
cycleOrientation() {
|
||||||
this.setOrientation((this.settings!.deviceOrientation + 90) % 360)
|
this.setOrientation((this.settings!.deviceOrientation + 1) % this.orientationLabels.length)
|
||||||
|
},
|
||||||
|
setIdleTimeout(timeout: number, updateDevice: boolean = true) {
|
||||||
|
this.settings!.idleTimeout = timeout
|
||||||
|
if (updateDevice) {
|
||||||
|
sendDebounced(this.currentDeviceId!, JSON.stringify({ settings: { idleTimeout: timeout } }))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setPosition(position: number) {
|
setPosition(position: number) {
|
||||||
this.position = position
|
this.position = position
|
||||||
|
|||||||
Reference in New Issue
Block a user