refactor(control): better indentation in ui_behavior

This commit is contained in:
E44
2026-01-14 18:48:57 +01:00
parent 5b93250e22
commit 548f8ccba8
@@ -1,4 +1,4 @@
import { writable, type Writable } from "svelte/store";
import { writable, type Writable } from 'svelte/store';
export const dnd_flip_duration_ms = 300;
@@ -6,27 +6,25 @@ const heights_options: Record<string, { min: number; max: number; step: number }
display: {
min: 15,
max: 40,
step: 5,
step: 5
},
file: {
min: 10,
max: 20,
step: 5,
step: 5
}
}
};
export const current_height: Writable<Record<string, number>> = writable<Record<string, number>>({
display: 25,
file: 10,
file: 10
});
export const is_group_drag: Writable<boolean> = writable<boolean>(false);
export const is_display_drag: Writable<boolean> = writable<boolean>(false);
export const pinned_display_id: Writable<string | null> = writable<string | null>(null);
export function change_height(key: 'display' | 'file', factor: number) {
current_height.update((height) => {
height[key] = next_height_step_size(key, height, factor) || height[key];
@@ -34,8 +32,12 @@ export function change_height(key: 'display' | 'file', factor: number) {
});
}
export function next_height_step_size(key: 'display' | 'file', current_height_array: Record<string, number>, factor: number): number {
const new_size = current_height_array[key] + (factor * heights_options[key].step);
export function next_height_step_size(
key: 'display' | 'file',
current_height_array: Record<string, number>,
factor: number
): number {
const new_size = current_height_array[key] + factor * heights_options[key].step;
if (new_size > heights_options[key].max || new_size < heights_options[key].min) {
return 0;
} else {
@@ -43,9 +45,6 @@ export function next_height_step_size(key: 'display' | 'file', current_height_ar
}
}
export function get_selectable_color_classes(
selected: boolean,
returning_classes: { bg?: boolean; hover?: boolean; active?: boolean; text?: boolean } = {},