enhance(frontend): improve ux of deck scroll
This commit is contained in:
parent
c63f56f79b
commit
65d0e8f683
|
@ -9,6 +9,7 @@
|
||||||
class="columns"
|
class="columns"
|
||||||
:class="deckStore.reactiveState.columnAlign.value"
|
:class="deckStore.reactiveState.columnAlign.value"
|
||||||
@contextmenu.self.prevent="onContextmenu"
|
@contextmenu.self.prevent="onContextmenu"
|
||||||
|
@wheel.self="onWheel"
|
||||||
>
|
>
|
||||||
<template v-for="ids in layout">
|
<template v-for="ids in layout">
|
||||||
<!-- sectionを利用しているのは、deck.vue側でcolumnに対してfirst-of-typeを効かせるため -->
|
<!-- sectionを利用しているのは、deck.vue側でcolumnに対してfirst-of-typeを効かせるため -->
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
) + 'px',
|
) + 'px',
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
@wheel.self="onWheel"
|
||||||
>
|
>
|
||||||
<DeckColumnCore
|
<DeckColumnCore
|
||||||
v-for="id in ids"
|
v-for="id in ids"
|
||||||
|
@ -50,6 +52,7 @@
|
||||||
:is-stacked="false"
|
:is-stacked="false"
|
||||||
:style="columns.find(c => c.id === ids[0])!.flexible ? { flex: 1, minWidth: '350px' } : { width: columns.find(c => c.id === ids[0])!.width + 'px' }"
|
:style="columns.find(c => c.id === ids[0])!.flexible ? { flex: 1, minWidth: '350px' } : { width: columns.find(c => c.id === ids[0])!.width + 'px' }"
|
||||||
@parent-focus="moveFocus(ids[0], $event)"
|
@parent-focus="moveFocus(ids[0], $event)"
|
||||||
|
@headerWheel="onWheel"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<div v-if="layout.length === 0" class="intro _panel">
|
<div v-if="layout.length === 0" class="intro _panel">
|
||||||
|
@ -279,18 +282,15 @@ const onContextmenu = (ev) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
document.documentElement.style.overflowY = "hidden";
|
function onWheel(ev: WheelEvent) {
|
||||||
document.documentElement.style.scrollBehavior = "auto";
|
if (ev.deltaX === 0) {
|
||||||
window.addEventListener("wheel", (ev) => {
|
|
||||||
if (ev.target === columnsEl && ev.deltaX === 0) {
|
|
||||||
columnsEl.scrollLeft += ev.deltaY;
|
|
||||||
} else if (
|
|
||||||
getScrollContainer(ev.target as HTMLElement) == null &&
|
|
||||||
ev.deltaX === 0
|
|
||||||
) {
|
|
||||||
columnsEl.scrollLeft += ev.deltaY;
|
columnsEl.scrollLeft += ev.deltaY;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
document.documentElement.style.overflowY = "hidden";
|
||||||
|
document.documentElement.style.scrollBehavior = "auto";
|
||||||
|
|
||||||
loadDeck();
|
loadDeck();
|
||||||
|
|
||||||
function moveFocus(id: string, direction: "up" | "down" | "left" | "right") {
|
function moveFocus(id: string, direction: "up" | "down" | "left" | "right") {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
@dragstart="onDragstart"
|
@dragstart="onDragstart"
|
||||||
@dragend="onDragend"
|
@dragend="onDragend"
|
||||||
@contextmenu.prevent.stop="onContextmenu"
|
@contextmenu.prevent.stop="onContextmenu"
|
||||||
|
@wheel="emit('headerWheel', $event)"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
v-if="isStacked && !isMainColumn"
|
v-if="isStacked && !isMainColumn"
|
||||||
|
@ -95,6 +96,7 @@ const props = withDefaults(
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: "parent-focus", direction: "up" | "down" | "left" | "right"): void;
|
(ev: "parent-focus", direction: "up" | "down" | "left" | "right"): void;
|
||||||
(ev: "change-active-state", v: boolean): void;
|
(ev: "change-active-state", v: boolean): void;
|
||||||
|
(ev: "headerWheel", ctx: WheelEvent): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let body = $ref<HTMLDivElement>();
|
let body = $ref<HTMLDivElement>();
|
||||||
|
|
Loading…
Reference in New Issue