From 61bc97df63f93a8f7424a549c5d49b5fbf8070f8 Mon Sep 17 00:00:00 2001 From: chenjiajian <770230504@qq.com> Date: Mon, 20 Mar 2023 18:36:12 +0800 Subject: [PATCH] fix --- src/scroll/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) }) }