Skip to content

Commit

Permalink
Hint - fix anchor position for x = 0 (#2556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Inbal-Tish authored Apr 16, 2023
1 parent ef741c0 commit 7a1c746
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/hint/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class Hint extends Component<HintProps, HintState> {
}

getTargetPositionOnScreen() {
if (this.targetLayout?.x && this.targetLayout?.width) {
if (this.targetLayout?.x !== undefined && this.targetLayout?.width) {
const targetMidPosition = this.targetLayout.x + this.targetLayout.width / 2;

if (targetMidPosition > this.containerWidth * (2 / 3)) {
Expand All @@ -314,7 +314,7 @@ class Hint extends Component<HintProps, HintState> {
const {position} = this.props;
const hintPositionStyle: HintPositionStyle = {alignItems: 'center'};

if (this.targetLayout?.x) {
if (this.targetLayout?.x !== undefined) {
hintPositionStyle.left = -this.targetLayout.x;
}

Expand All @@ -337,7 +337,7 @@ class Hint extends Component<HintProps, HintState> {
getHintPadding() {
const paddings: Paddings = {paddingVertical: this.hintOffset, paddingHorizontal: this.edgeMargins};

if (this.useSideTip && this.targetLayout?.x) {
if (this.useSideTip && this.targetLayout?.x !== undefined) {
const targetPositionOnScreen = this.getTargetPositionOnScreen();
if (targetPositionOnScreen === TARGET_POSITIONS.LEFT) {
paddings.paddingLeft = this.targetLayout.x;
Expand Down Expand Up @@ -376,7 +376,7 @@ class Hint extends Component<HintProps, HintState> {

const layoutWidth = this.targetLayout?.width || 0;

if (this.targetLayout?.x) {
if (this.targetLayout?.x !== undefined) {
const targetMidWidth = layoutWidth / 2;
const tipMidWidth = this.tipSize.width / 2;

Expand Down

0 comments on commit 7a1c746

Please sign in to comment.