scalingUtils

Scaling utilities for handling app scaling across all user applications Provides methods to handle coordinate transformations, element positioning, and mouse interactions when apps are scaled by the OS

Methods

(static) appToScreenCoords(appX, appY, zoomScaleopt) → {object}

Convert app coordinates to screen coordinates (accounting for app scale and optional zoom)
Parameters:
NameTypeAttributesDefaultDescription
appXnumberApp X coordinate
appYnumberApp Y coordinate
zoomScalenumber<optional>
1.0Optional zoom scale
Returns:
Object with x and y properties in screen coordinates
Type: 
object

(static) detectAppScale() → {number}

Detect the current app scale from CSS transform
Returns:
Scale factor (1.0 = 100%, 0.8 = 80%, etc.)
Type: 
number

(static) getCurrentScale() → {number}

Get current cached app scale (without re-detection)
Returns:
Cached app scale factor
Type: 
number

(static) getEffectiveScale(zoomScaleopt) → {number}

Get the total effective scale (app scale × optional zoom scale)
Parameters:
NameTypeAttributesDefaultDescription
zoomScalenumber<optional>
1.0Optional zoom scale to combine with app scale
Returns:
Combined scale factor
Type: 
number

(static) getScaledBoundingClientRect(element) → {object}

Get scaled element bounding rectangle (compensates for app scaling)
Parameters:
NameTypeDescription
elementElementDOM element to get bounds for
Returns:
DOMRect-like object with scaled coordinates
Type: 
object

(static) getScaledMouseCoords(e) → {object}

Get scaled mouse coordinates from event (compensates for app scaling only)
Parameters:
NameTypeDescription
eEventMouse event
Returns:
Object with x and y properties in scaled coordinates
Type: 
object

(static) initScaleDetection(onScaleChangeopt) → {MutationObserver}

Initialize scale detection with optional change callback
Parameters:
NameTypeAttributesDescription
onScaleChangefunction<optional>
Callback function called when scale changes
Returns:
Observer instance for cleanup
Type: 
MutationObserver

(static) refreshScale() → {number}

Force refresh of scale detection
Returns:
New scale factor
Type: 
number

(static) screenToAppCoords(screenX, screenY, zoomScaleopt) → {object}

Convert screen coordinates to app coordinates (accounting for app scale and optional zoom)
Parameters:
NameTypeAttributesDefaultDescription
screenXnumberScreen X coordinate
screenYnumberScreen Y coordinate
zoomScalenumber<optional>
1.0Optional zoom scale
Returns:
Object with x and y properties in app coordinates
Type: 
object