Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guided tour/feedback #201

Merged
merged 3 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions src/BIMDataComponents/BIMDataGuidedTour/BIMDataGuidedTour.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
v-if="currentStep"
ref="tooltip"
class="tooltip"
:style="{ opacity: showTooltip ? 1 : 0 }"
:style="{
opacity: showTooltip ? 1 : 0,
transition: `opacity ${transitionDuration}s ease-in-out`,
}"
>
<div class="tooltip__progress-bar">
<div
Expand Down Expand Up @@ -148,6 +151,10 @@ export default {
type: Number,
default: () => 10000,
},
transitionDuration: {
type: Number,
default: () => 0.3,
},
},
emits: ["set-completed-tour"],
data() {
Expand All @@ -158,7 +165,6 @@ export default {
showSpotlight: true,
showTooltip: false,
stepIndex: 0,
console,
};
},
computed: {
Expand All @@ -185,11 +191,13 @@ export default {
async currentStep(step) {
try {
if (!step) return;
this.currentTarget = null;

if (step.target) {
this.currentTarget = this.getDomElements(step);
} else {
this.displayCenteredTooltip();
// display a centered tooltip
this.showTooltip = true;
return;
}

Expand Down Expand Up @@ -227,14 +235,16 @@ export default {
},
methods: {
clickNext() {
if (this.currentStep.clickable) {
(
this.currentTarget.elementToClick || this.currentTarget.element
).click();
} else {
this.next();
}
this.resetSettings();
setTimeout(() => {
if (this.currentStep.clickable) {
(
this.currentTarget.elementToClick || this.currentTarget.element
).click();
} else {
this.next();
}
}, this.transitionDuration * 1000);
},
openGuidedTour(arg) {
this.steps = arg.map(step => {
Expand Down Expand Up @@ -286,21 +296,8 @@ export default {
this.$emit("set-completed-tour", this.tourToDisplay);
},
resetSettings() {
this.currentTarget = null;

this.showSpotlight = false;
this.showSpotlight = this.currentStep.clickable ? false : true;
this.showTooltip = false;

this.$refs.tooltip.style.boxShadow = "0 2px 10px 0 rgba(0, 0, 0, 0.5)";
this.$refs.tooltip.style.removeProperty("left");
this.$refs.tooltip.style.removeProperty("top");
},
displayCenteredTooltip() {
this.showTooltip = true;
if (this.$refs.tooltip) {
this.$refs.tooltip.style.boxShadow =
"0 0 0, 0 0 0 10000vmax rgba(0,0,0,0.5)";
}
},
clickListener() {
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
position: absolute;
box-shadow:
0 0 0,
0 0 0 10000vmax rgba(0,0,0,0.5);
0 0 0 10000vmax var(--color-primary);
opacity: 0.8;
}

.tooltip {
Expand All @@ -17,7 +18,7 @@
height: 362px;
border-radius: 2px;
background-color: white;
box-shadow: 0 2px 10px 0 rgba(0,0,0,0.5);
box-shadow: var(--box-shadow);

display: flex;
flex-direction: column;
Expand Down
9 changes: 6 additions & 3 deletions src/BIMDataComponents/BIMDataGuidedTour/guided-tour-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ function setSpotlightPosition(target, spotlight) {
}

function setTooltipPosition(target, tooltip) {
const { x: xTarget, y: yTarget, w: wTarget, h: hTarget } = getElementCoord(
target
);
const {
x: xTarget,
y: yTarget,
w: wTarget,
h: hTarget,
} = getElementCoord(target);

const { w: wToolTip, h: hTooltip } = getElementCoord(tooltip);
const { wWindow, hWindow } = getWindowSize();
Expand Down