From 7a1c746a9d0b2f7e91b46e4f0be1b322cbf2544c Mon Sep 17 00:00:00 2001 From: Inbal Tish <33805983+Inbal-Tish@users.noreply.github.com> Date: Sun, 16 Apr 2023 11:46:50 +0300 Subject: [PATCH] Hint - fix anchor position for x = 0 (#2556) --- src/components/hint/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/hint/index.tsx b/src/components/hint/index.tsx index 5baba45250..b261977108 100644 --- a/src/components/hint/index.tsx +++ b/src/components/hint/index.tsx @@ -291,7 +291,7 @@ class Hint extends Component { } 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)) { @@ -314,7 +314,7 @@ class Hint extends Component { const {position} = this.props; const hintPositionStyle: HintPositionStyle = {alignItems: 'center'}; - if (this.targetLayout?.x) { + if (this.targetLayout?.x !== undefined) { hintPositionStyle.left = -this.targetLayout.x; } @@ -337,7 +337,7 @@ class Hint extends Component { 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; @@ -376,7 +376,7 @@ class Hint extends Component { 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;