diff --git a/src/scroll/index.js b/src/scroll/index.js index 23928e1..85634b1 100644 --- a/src/scroll/index.js +++ b/src/scroll/index.js @@ -18,6 +18,7 @@ class Scroll extends Component { distance: 0 } dragging = false + hovering = false static styles = [ css` :host { @@ -85,10 +86,12 @@ class Scroll extends Component { } onmouseenter() { + this.hovering = true this.$refs.vertical.style.opacity = 0.3 this.$refs.horizon.style.opacity = 0.3 } onmouseleave() { + this.hovering = false if (!this.dragging) { this.$refs.vertical.style.opacity = 0 this.$refs.horizon.style.opacity = 0 @@ -131,8 +134,10 @@ class Scroll extends Component { this.onmouseup = bind(document, 'mouseup', () => { this.dragging = false - this.$refs.vertical.style.opacity = 0 - this.$refs.horizon.style.opacity = 0 + if (!this.hovering) { + this.$refs.vertical.style.opacity = 0 + this.$refs.horizon.style.opacity = 0 + } unbind(document, 'mousemove', onmousemove) }) }