feat: add mouse wheel horizontal scrolling to TagList and update package version

This commit is contained in:
kuekhaoyang
2025-12-29 11:34:48 +08:00
parent 7f0b37cda5
commit f5b9fcf0d1
3 changed files with 24 additions and 3 deletions
+21
View File
@@ -65,6 +65,27 @@ export function TagList({
}
}, [justAddedTag, onJustAddedTagHandled]);
// Handle horizontal scroll with mouse wheel
useEffect(() => {
const container = scrollContainerRef.current;
if (!container) return;
const handleWheel = (e: WheelEvent) => {
// Check if it's a vertical scroll (mostly deltaY) and negligible horizontal scroll
if (e.deltaY !== 0 && Math.abs(e.deltaX) < Math.abs(e.deltaY)) {
e.preventDefault();
container.scrollLeft += e.deltaY;
}
};
// Add passive: false to allow preventDefault
container.addEventListener('wheel', handleWheel, { passive: false });
return () => {
container.removeEventListener('wheel', handleWheel);
};
}, []);
const handleDragStart = (event: DragStartEvent) => {
setActiveId(event.active.id as string);
};
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "kvideo",
"version": "3.8.0",
"version": "3.8.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "kvideo",
"version": "3.8.0",
"version": "3.8.4",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "kvideo",
"version": "3.8.0",
"version": "3.8.4",
"private": true,
"scripts": {
"dev": "next dev",