master
chenjiajian 2023-03-20 18:36:12 +08:00
parent 480d22d60c
commit 61bc97df63
1 changed files with 7 additions and 2 deletions

View File

@ -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
if (!this.hovering) {
this.$refs.vertical.style.opacity = 0
this.$refs.horizon.style.opacity = 0
}
unbind(document, 'mousemove', onmousemove)
})
}