From e5217e62f16a97e131f594fb4a9451c9d221a984 Mon Sep 17 00:00:00 2001 From: Sajjad Asadi Date: Thu, 20 Sep 2018 01:35:16 +0430 Subject: [PATCH] added onWheel zoom support --- src/js/pages/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/js/pages/index.js b/src/js/pages/index.js index 38b91c1..1276067 100644 --- a/src/js/pages/index.js +++ b/src/js/pages/index.js @@ -61,7 +61,16 @@ class Map extends Component { this.handleReset = this.handleReset.bind(this) this.handlePersonHover = this.handlePersonHover.bind(this) this.handlePersonHoverOut = this.handlePersonHoverOut.bind(this) + this.handleWheel=this.handleWheel.bind(this); } + handleWheel(scroll) { + console.log(scroll); + if (scroll.deltaY > 0) { + this.handleZoomOut(); + } else if (scroll.deltaY < 0) { + this.handleZoomIn(); + } + } handleZoomIn() { this.setState({ zoom: this.state.zoom * 2, @@ -119,7 +128,7 @@ class Map extends Component { render() { return ( -
+
{ people.map((person, i) => (