Function subtractSize

  • Subtracts a width & height from a. Leaves x & y as-is.

    const rect = { x: 10, y: 20, width: 100, height: 200 };
    subtractSize(rect, { width: 50, height: 100 });
    subtractSize(rec, 50, 100);
    // Both yields: { x:10, y: 20, width: 50, height: 100 }

    Parameters

    • a: RectPositioned

      Rectangle

    • b: number | Rect

      Rectangle to subtract by, or width

    • Optionalc: number

      Height, if second parameter is width

    Returns RectPositioned

  • Subtracts a width & height from a.

    const rect = { width: 100, height: 200 };
    subtractSize(rect, { width: 50, height: 100 });
    subtractSize(rec, 50, 100);
    // Both yields: { width: 50, height: 100 }

    Parameters

    • a: Rect

      Rectangle

    • b: number | Rect

      Rectangle to subtract by, or width

    • Optionalc: number

      Height, if second parameter is width

    Returns Rect