Skip to content

Commit

Permalink
fix(esl-popup): fix it is not possible to set the offset-arrow to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dshovchko committed May 21, 2024
1 parent 647b736 commit c6f1a9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/esl-popup/core/esl-popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class ESLPopup extends ESLToggleable {
/** Get offsets arrow ratio */
@memoize()
protected get offsetArrowRatio(): number {
const offset = parseNumber(this.offsetArrow, DEFAULT_OFFSET_ARROW) || DEFAULT_OFFSET_ARROW;
const offset = parseNumber(this.offsetArrow, DEFAULT_OFFSET_ARROW);
const offsetNormalized = Math.max(0, Math.min(offset, 100));
const ratio = offsetNormalized / 100;
return isRTL(this) ? 1 - ratio : ratio;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/esl-utils/misc/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const parseBoolean = (val: string | null): boolean => val !== null && val
export function parseNumber(str: string | number): number | undefined;
/**
* Parses number with the ability to pass an alternative fallback for NaN.
* Note: falsy values except 0 are treated as NaN3
* Note: falsy values except 0 are treated as NaN
*/
export function parseNumber(str: string | number, nanValue: number): number;
export function parseNumber(str: string | number, nanValue?: number): number | undefined {
Expand Down

0 comments on commit c6f1a9f

Please sign in to comment.