Skip to content

Commit

Permalink
render arrow in slow devices
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Feb 11, 2022
1 parent e777de7 commit 908d487
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div id="app" :class="{'value-masked': amountsHidden}">
<!-- (?) This could be moved to Groundfloor.vue -->
<transition v-if="showTour" name="delay">
<Tour/>
</transition>
Expand Down
20 changes: 12 additions & 8 deletions src/components/Tour.vue
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,18 @@ export default defineComponent({
<path d="M3.3 7.2A4 4 0 0 1 0 9h18a4 4 0 0 1-3.3-1.8L10.3.8c-.6-.9-1.9-.9-2.5 0L3.3 7.2z"/>
</svg>`;
function _changeArrowAppearance(stepIndex: TourStepIndex) {
setTimeout(() => {
const arrow = $(
`[data-step="${stepIndex}"] [data-popper-arrow]`) as HTMLDivElement;
if (!arrow) return;
arrow.innerHTML = arrowSvg;
arrow.style.visibility = 'initial';
arrow.style.width = '2rem';
}, 100);
// It has been detected that some slower devices are not able to render the arrow
// in time, therefore we need to wait until the arrow is rendered and try a few times
Array.from({ length: 10 }).forEach((_, i) => {
setTimeout(() => {
const arrow = $(
`[data-step="${stepIndex}"] [data-popper-arrow]`) as HTMLDivElement;
if (!arrow) return;
arrow.innerHTML = arrowSvg;
arrow.style.visibility = 'initial';
arrow.style.width = '2rem';
}, 100 * i);
});
}
return {
Expand Down

0 comments on commit 908d487

Please sign in to comment.