Skip to content

Commit

Permalink
fix(core): Hint fix mobile offscreen overflow (#2879)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea authored Oct 12, 2022
1 parent c387fb2 commit 5d606b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion projects/core/directives/hint/hint-position.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ export class TuiHintPositionDirective implements TuiPositionAccessor {
this.checkPosition(this.points[direction], width, height),
);

return this.points[direction || this.direction];
return this.points[direction || this.fallback];
}

private get fallback(): TuiHintDirection {
return this.points.top[TOP] > this.windowRef.innerHeight - this.points.bottom[TOP]
? `top`
: `bottom`;
}

private checkPosition([top, left]: TuiPoint, width: number, height: number): boolean {
Expand Down

0 comments on commit 5d606b3

Please sign in to comment.