Skip to content

Commit

Permalink
fix: Rename scrollbar size constant for clarity
Browse files Browse the repository at this point in the history
Renamed `BROWSER_SCROLL_SIZE` to `BROWSER_SCROLLBAR_WIDTH` to provide a clearer description of its purpose. Updated related references and comments to reflect this change, ensuring consistency and maintaining accurate documentation.
  • Loading branch information
Gondragos committed Mar 4, 2025
1 parent 046fb9c commit f315f8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions web/libs/editor/src/lib/AudioUltra/Common/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,17 @@ export const isTimeRelativelySimilar = (a: number, b: number, observedDuration:
isTimeSimilar(a / observedDuration, b / observedDuration);

/**
* A constant representing the width of the browser's scrollbar in pixels.
* A constant representing the thickness of the scrollbar's handle in pixels.
* This value is calculated dynamically by creating a temporary DOM element
* with a scrollable area and comparing its offset width to its client width.
* Useful for making precise layout adjustments that depend on the scrollbar size.
* Useful for making precise layout adjustments that depend on the width of the scrollbar.
*
* Note: The calculation is performed immediately when the variable is defined
* and retains its value for the duration of runtime.
*
* @constant {number}
*/
export const BROWSER_SCROLL_SIZE = ((): number => {
export const BROWSER_SCROLLBAR_WIDTH = ((): number => {
const scrollDiv = document.createElement("div");
scrollDiv.style.width = "100px";
scrollDiv.style.height = "100px";
Expand Down
6 changes: 3 additions & 3 deletions web/libs/editor/src/lib/AudioUltra/Visual/Visualizer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WaveformAudio } from "../Media/WaveformAudio";
import { averageMinMax, BROWSER_SCROLL_SIZE, clamp, debounce, defaults, warn } from "../Common/Utils";
import { averageMinMax, BROWSER_SCROLLBAR_WIDTH, clamp, debounce, defaults, warn } from "../Common/Utils";
import type { Waveform, WaveformOptions } from "../Waveform";
import { type CanvasCompositeOperation, Layer, type RenderingContext } from "./Layer";
import { Events } from "../Common/Events";
Expand Down Expand Up @@ -665,7 +665,7 @@ export class Visualizer extends Events<VisualizerEvents> {
this.scrollFiller = document.createElement("div");
this.scrollFiller.style.position = "absolute";
this.scrollFiller.style.width = "100%";
this.scrollFiller.style.height = `${BROWSER_SCROLL_SIZE}px`;
this.scrollFiller.style.height = `${BROWSER_SCROLLBAR_WIDTH}px`;
this.scrollFiller.style.top = "100%";
this.wrapper.appendChild(this.scrollFiller);

Expand Down Expand Up @@ -974,7 +974,7 @@ export class Visualizer extends Events<VisualizerEvents> {
};

private setContainerHeight() {
this.container.style.height = `${this.height + BROWSER_SCROLL_SIZE}px`;
this.container.style.height = `${this.height + BROWSER_SCROLLBAR_WIDTH}px`;
}

private updateSize() {
Expand Down

0 comments on commit f315f8b

Please sign in to comment.