Skip to content

Commit

Permalink
Remove unnecessary internal function
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorejb committed Dec 13, 2024
1 parent dab5327 commit 34b1ad6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/cropt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,11 @@ function debounce<T extends Function>(func: T, wait: number) {
};
}

function fix(value: number, decimalPoints: number) {
return value.toFixed(decimalPoints);
}

function setZoomerVal(value: number, zoomer: HTMLInputElement) {
const zMin = parseFloat(zoomer.min);
const zMax = parseFloat(zoomer.max);

zoomer.value = fix(Math.max(zMin, Math.min(zMax, value)), 3);
zoomer.value = Math.max(zMin, Math.min(zMax, value)).toFixed(3);
}

function loadImage(src: string): Promise<HTMLImageElement> {
Expand Down Expand Up @@ -682,8 +678,8 @@ export class Cropt {
maxZoom += minZoom;
}

this.elements.zoomer.min = fix(minZoom, 3);
this.elements.zoomer.max = fix(maxZoom, 3);
this.elements.zoomer.min = minZoom.toFixed(3);
this.elements.zoomer.max = maxZoom.toFixed(3);
let zoom = this.#boundZoom;

if (zoom === null) {
Expand Down

0 comments on commit 34b1ad6

Please sign in to comment.