Skip to content

Commit

Permalink
Merge b746303 into b4fa8ed
Browse files Browse the repository at this point in the history
  • Loading branch information
Itziar88 committed Feb 17, 2020
2 parents b4fa8ed + b746303 commit 2436c7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
8 changes: 6 additions & 2 deletions src/components/Common/WDot/WDot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ export default {
dotListeners () {
return merge({}, this.$listeners, {
click: (event) => {
if (this.trigger === 'click') this.handleActive(event)
if (this.trigger === 'click') {
if ((this.Chart.active.el || {}).id !== (this.info || {}).id) this.handleActive(event)
else this.Chart.cleanActive()
}
this.$emit('onClick', this.info)
},
mouseenter: (event) => {
if (this.trigger === 'hover') this.handleActive(event)
this.$emit('onMouseenter', this.info)
},
mouseleave: () => {
if (['hover', 'click'].includes(this.trigger)) this.Chart.cleanActive()
if (['hover'].includes(this.trigger)) this.Chart.cleanActive()
this.$emit('onMouseleave')
},
})
Expand Down
25 changes: 15 additions & 10 deletions src/components/Pie/WPie/WPie.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,21 @@ export default {
pieListeners () {
return merge({}, this.$listeners, {
click: (event) => {
const id = parseInt(event.target.id, 0)
if (this.trigger === 'click') {
this.setActivePath(parseInt(event.target.id, 0))
this.handleActive(event)
if (this.activePath !== id) this.handleSetActive(id, event)
else this.handleCleanActive()
}
this.$emit('onClick')
},
mouseenter: (event) => {
if (this.trigger === 'hover') {
this.setActivePath(parseInt(event.target.id, 0))
this.handleActive(event)
}
const id = parseInt(event.target.id, 0)
if (this.trigger === 'hover') this.handleSetActive(id, event)
this.$emit('onMouseenter')
},
mouseleave: () => {
if (['hover', 'click'].includes(this.trigger)) {
this.setActivePath(null)
this.Chart.cleanActive()
}
if (['hover'].includes(this.trigger)) this.handleCleanActive()
this.$emit('onMouseleave')
},
})
Expand Down Expand Up @@ -228,6 +225,14 @@ export default {
},
},
methods: {
handleSetActive (id, event) {
this.setActivePath(id)
this.handleActive(event)
},
handleCleanActive () {
this.setActivePath(null)
this.Chart.cleanActive()
},
setActivePath (id) {
if ([null, undefined].includes(this.itemActive)) this.activePath = id
},
Expand Down

0 comments on commit 2436c7b

Please sign in to comment.