From 1cc68d15ebdd1a2b9d3eb1314d5d88765e52fc76 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Mon, 23 May 2022 07:48:23 +1000
Subject: Enable vertical wheel-scroll on horizontal ancestry bar

---
 src/components/AncestryBar.vue | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'src/components/AncestryBar.vue')

diff --git a/src/components/AncestryBar.vue b/src/components/AncestryBar.vue
index 5419f78..2dd19fb 100644
--- a/src/components/AncestryBar.vue
+++ b/src/components/AncestryBar.vue
@@ -73,7 +73,13 @@ export default defineComponent({
 		},
 		onInfoIconClick(data: string){
 			this.$emit('info-icon-click', data);
-		}
+		},
+		onWheelEvt(evt: WheelEvent){
+			// Possibly convert vertical scroll to horizontal
+			if (this.wideArea && Math.abs(evt.deltaX) < Math.abs(evt.deltaY)){
+				this.$el.scrollLeft -= (evt.deltaY > 0 ? 30 : -30);
+			}
+		},
 	},
 	components: {Tile, },
 	emits: ['detached-ancestor-click', 'info-icon-click', ],
@@ -81,7 +87,7 @@ export default defineComponent({
 </script>
 
 <template>
-<div :style="styles">
+<div :style="styles" @wheel.stop="onWheelEvt">
 	<tile v-for="(node, idx) in usedNodes" :key="node.name" class="shrink-0"
 		:layoutNode="node" :tolMap="tolMap" :nonAbsPos="true" :lytOpts="lytOpts" :uiOpts="uiOpts"
 		@leaf-click="onTileClick(nodes[idx])" @info-icon-click="onInfoIconClick"/>
-- 
cgit v1.2.3

