Skip to content

Commit 7a1c746

Browse files
authored
Hint - fix anchor position for x = 0 (#2556)
1 parent ef741c0 commit 7a1c746

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/hint/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class Hint extends Component<HintProps, HintState> {
291291
}
292292

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

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

317-
if (this.targetLayout?.x) {
317+
if (this.targetLayout?.x !== undefined) {
318318
hintPositionStyle.left = -this.targetLayout.x;
319319
}
320320

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

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

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

379-
if (this.targetLayout?.x) {
379+
if (this.targetLayout?.x !== undefined) {
380380
const targetMidWidth = layoutWidth / 2;
381381
const tipMidWidth = this.tipSize.width / 2;
382382

0 commit comments

Comments
 (0)