Skip to content

Commit

Permalink
fixed hover tooltip on learning elements
Browse files Browse the repository at this point in the history
  • Loading branch information
DerKatsche committed Nov 20, 2023
1 parent 70ec9d8 commit 42448b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default class LearningElementController
implements ILearningElementController
{
private bottomTooltipPresenter: IBottomTooltipPresenter;
private proximityToolTipId: number = -1;
private hoverToolTipId: number = -1;

constructor(private viewModel: LearningElementViewModel) {
this.bottomTooltipPresenter = CoreDIContainer.get<IBottomTooltipPresenter>(
Expand All @@ -25,14 +27,19 @@ export default class LearningElementController

@bind
pointerOver(): void {
this.displayTooltip();
this.scaleUpIcon();
if (this.proximityToolTipId === -1 && this.hoverToolTipId === -1) {
this.proximityToolTipId = this.displayTooltip();
this.scaleUpIcon();
}
}

@bind
pointerOut(): void {
this.bottomTooltipPresenter.hide();
this.resetIconScale();
if (this.hoverToolTipId !== -1) {
this.resetIconScale();
this.bottomTooltipPresenter.hide(this.hoverToolTipId);
this.hoverToolTipId = -1;
}
}

@bind
Expand All @@ -49,16 +56,16 @@ export default class LearningElementController
@bind
private onAvatarInteractableChange(isInteractable: boolean): void {
if (isInteractable) {
this.displayTooltip();
this.proximityToolTipId = this.displayTooltip();
this.scaleUpIcon();
} else {
this.bottomTooltipPresenter.hide();
} else if (this.proximityToolTipId !== -1) {
this.bottomTooltipPresenter.hide(this.proximityToolTipId);
this.resetIconScale();
}
}

private displayTooltip(): void {
this.bottomTooltipPresenter.display(
private displayTooltip(): number {
return this.bottomTooltipPresenter.display(
this.viewModel.name,
this.viewModel.type,
this.viewModel.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default class LearningElementPresenter

if (distance <= interactionRadius)
this.viewModel.isInteractable.Value = true;
else if (this.viewModel.isInteractable.Value)
this.viewModel.isInteractable.Value = false;
else this.viewModel.isInteractable.Value = false;
}
}

0 comments on commit 42448b5

Please sign in to comment.