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
- Source
Methods
(static) appToScreenCoords(appX, appY, zoomScaleopt) → {object}
Convert app coordinates to screen coordinates (accounting for app scale and optional zoom)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
appX | number | App X coordinate | ||
appY | number | App Y coordinate | ||
zoomScale | number | <optional> | 1.0 | Optional zoom scale |
- Source
Returns:
Object with x and y properties in screen coordinates
- Type:
- object
(static) detectAppScale() → {number}
Detect the current app scale from CSS transform
- Source
Returns:
Scale factor (1.0 = 100%, 0.8 = 80%, etc.)
- Type:
- number
(static) getCurrentScale() → {number}
Get current cached app scale (without re-detection)
- Source
Returns:
Cached app scale factor
- Type:
- number
(static) getEffectiveScale(zoomScaleopt) → {number}
Get the total effective scale (app scale × optional zoom scale)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
zoomScale | number | <optional> | 1.0 | Optional zoom scale to combine with app scale |
- Source
Returns:
Combined scale factor
- Type:
- number
(static) getScaledBoundingClientRect(element) → {object}
Get scaled element bounding rectangle (compensates for app scaling)
Parameters:
Name | Type | Description |
---|---|---|
element | Element | DOM element to get bounds for |
- Source
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:
Name | Type | Description |
---|---|---|
e | Event | Mouse event |
- Source
Returns:
Object with x and y properties in scaled coordinates
- Type:
- object
(static) initScaleDetection(onScaleChangeopt) → {MutationObserver}
Initialize scale detection with optional change callback
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onScaleChange | function | <optional> | Callback function called when scale changes |
- Source
Returns:
Observer instance for cleanup
- Type:
- MutationObserver
(static) refreshScale() → {number}
Force refresh of scale detection
- Source
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:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
screenX | number | Screen X coordinate | ||
screenY | number | Screen Y coordinate | ||
zoomScale | number | <optional> | 1.0 | Optional zoom scale |
- Source
Returns:
Object with x and y properties in app coordinates
- Type:
- object