From 640c5e6dfc9e854585ed6e71b137cbfca4529e9c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 Sep 2020 22:23:53 +0200 Subject: scrolling on section nav --- .../frontend/app/views/viewer/sections/viewer.sections.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'animism-align/frontend/app/views/viewer/sections/viewer.sections.js') diff --git a/animism-align/frontend/app/views/viewer/sections/viewer.sections.js b/animism-align/frontend/app/views/viewer/sections/viewer.sections.js index e0ec212..8e6f39b 100644 --- a/animism-align/frontend/app/views/viewer/sections/viewer.sections.js +++ b/animism-align/frontend/app/views/viewer/sections/viewer.sections.js @@ -10,15 +10,28 @@ import { thumbnailURL, sectionProgressPercentage } from 'app/utils/annotation.ut import { SpeakerIcon } from '../nav/viewer.icons' class ViewerSections extends Component { + constructor(props) { + super(props) + this.scrollRef = React.createRef() + this.handleWheel = this.handleWheel.bind(this) + } shouldComponentUpdate(nextProps) { if (nextProps.nav !== this.props.nav) return true return nextProps.nav } + handleWheel(e) { + let delta = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? e.deltaY : e.deltaX + this.scrollRef.current.scrollLeft += delta + } render() { const { play_ts, sections, currentSection } = this.props return (
-
+
this.handleWheel(e)} + > {sections.map(section => { // console.log(section) const media = section.media.length ? section.media[0].media : null -- cgit v1.2.3-70-g09d2