Layout Inset Content Rectangle

Compute axis-aligned inset content geometry, retaining an overconstrained flag when opposing insets exceed available size.

Description

Compute axis-aligned inset content geometry, retaining an overconstrained flag when opposing insets exceed available size.

Insets move a content origin inward and reduce its extents. Oversized insets should remain visible as an overconstraint flag.

When to use this tool

Compute axis-aligned inset content geometry, retaining an overconstrained flag when opposing insets exceed available size.

  • Prepare the supplied rectangle, top, right, bottom, left fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter rectangle, top, right, bottom, left. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.rectangle, result.overconstrained. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require nonnegative top/right/bottom/left. Shift origin by left/top, subtract opposing insets, clamp each negative extent to zero and return overconstrained when either unclamped extent is negative.1

Input fieldMeaning and representationAccepted input
rectanglerectangle.List of finite numbers; bounded by the operation
toptop.Finite number
rightright.Finite number
bottombottom.Finite number
leftleft.Finite number
Output fieldInterpretation
resultObject containing the named outputs below.
result.rectangleThe rectangle list in the ordering and representation described above.
result.overconstrainedWhether opposing insets exceeded either original rectangle extent before clamping.
json
{
  "input": {
    "rectangle": [
      0,
      0,
      10,
      10
    ],
    "top": 1,
    "right": 2,
    "bottom": 3,
    "left": 4
  },
  "output": {
    "result": {
      "rectangle": [
        4,
        1,
        4,
        6
      ],
      "overconstrained": false
    }
  }
}

Limitations and assumptions

  • The origin is still shifted even when clamped. No CSS box sizing, border, padding inheritance or layout measurement is applied.
  • Rectangle arrays use [x,y,width,height] with nonnegative extents. All dimensions must use the same coordinate frame and unit; values are supplied rather than measured from a page.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • String lists have at most 128 entries of at most 128 code units; matrices have at most 128 rows and columns. Larger numeric lists and parsed JSON have separate bounded budgets. Nonfinite results and excessively large serialized outputs are rejected.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Measure the actual layout when browser behavior matters. The formulas use supplied coordinates and explicit simplifications; they do not account for every box, writing mode, clipping ancestor or simultaneous layout change.

References

  1. Tool behavior and example: Layout Inset Content Rectangle — tool.io

Similar or alternative tools

  • Layout Rectangle Overlap Pairs

    List unique unordered rectangle pairs with positive overlap area; edge touching, z-order and occlusion are not counted as area overlap.

  • Layout Adjacent Gap Measure

    Measure signed physical adjacency gap from the first trailing edge to the second leading edge; negative means overlap along that axis.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies