Subtracts a width & height from a. Leaves x & y as-is.
a
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 } Copy
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 }
Rectangle
Rectangle to subtract by, or width
Optional
Height, if second parameter is width
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 } Copy
const rect = { width: 100, height: 200 };subtractSize(rect, { width: 50, height: 100 });subtractSize(rec, 50, 100);// Both yields: { width: 50, height: 100 }
Subtracts a width & height from
a
. Leaves x & y as-is.