Skip to content

Commit

Permalink
Fix issue when starting opened and fixed tooltips set to true (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Edujugon committed Oct 27, 2018
1 parent 75d7f50 commit 8e466ec
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/FAB.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<transition
enter-active-class="animated quick zoomIn"
leave-active-class="animated quick zoomOut"
v-on:after-enter="afterActionsTransitionEnter"
>
<template v-if="action.tooltip">
<li v-if="toggle" :style="{ 'background-color': action.color || bgColor }"
Expand Down Expand Up @@ -116,6 +117,9 @@
fixedTooltip: {
default: false
},
tooltipTimeOutWhenStartOpened: {
default: 200
},
enableRotation:{
default: true
},
Expand Down Expand Up @@ -276,19 +280,19 @@
wrapper.insertBefore(el, wrapper.childNodes[0]);
}
},
showTooltip(show) {
if (show && this.actions.length && this.fixedTooltip) {
//timeout to prevent wrong position for the tooltip
setTimeout(() => {
this.$refs.actions.forEach((item) => {
if(this.toggle) {
item._tooltip.show();
}
});
},700);
showTooltip(timeOut = 0) {
if (this.toggle && this.actions.length && this.fixedTooltip) {
setTimeout(() => {
this.$refs.actions.forEach((item) => {
if(this.toggle) {
item._tooltip.show();
}
});
},timeOut);
}
},
afterActionsTransitionEnter() {
this.showTooltip();
}
},
watch: {
Expand All @@ -299,16 +303,17 @@
this.moveTransition();
this.tooltipPos();
});
},
toggle(val) {
this.showTooltip(val);
}
},
mounted() {
this.moveTransition();
},
created() {
this.setPosition();
if (this.startOpened) {
this.showTooltip(this.tooltipTimeOutWhenStartOpened);
}
}
}
</script>
Expand Down

0 comments on commit 8e466ec

Please sign in to comment.