How to use the @here/harp-utils.MathUtils.map function in @here/harp-utils

To help you get started, we’ve selected a few @here/harp-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-mapview / lib / poi / PixelPicker.ts View on Github external
export function screenToUvCoordinates(
    screenX: number,
    screenY: number,
    box: Math2D.Box,
    uvBox: Math2D.UvBox
): { u: number; v: number } {
    const minX = box.x;
    const maxX = box.x + box.w;
    const minY = box.y;
    const maxY = box.y + box.h;
    const u = MathUtils.map(screenX, minX, maxX, uvBox.s0, uvBox.s1);
    const v = MathUtils.map(screenY, minY, maxY, uvBox.t0, uvBox.t1);

    return { u, v };
}
github heremaps / harp.gl / @here / harp-mapview / lib / poi / PixelPicker.ts View on Github external
export function screenToUvCoordinates(
    screenX: number,
    screenY: number,
    box: Math2D.Box,
    uvBox: Math2D.UvBox
): { u: number; v: number } {
    const minX = box.x;
    const maxX = box.x + box.w;
    const minY = box.y;
    const maxY = box.y + box.h;
    const u = MathUtils.map(screenX, minX, maxX, uvBox.s0, uvBox.s1);
    const v = MathUtils.map(screenY, minY, maxY, uvBox.t0, uvBox.t1);

    return { u, v };
}