Tooltip Side Free Space
Measure signed free space on four sides of an anchor rectangle inside a viewport; negative values retain overflow evidence.
Description
Measure signed free space on four sides of an anchor rectangle inside a viewport; negative values retain overflow evidence.
The free space beside an anchor can be expressed as four signed distances to viewport edges.
When to use this tool
Measure signed free space on four sides of an anchor rectangle inside a viewport; negative values retain overflow evidence.
- Prepare the supplied anchor, viewport 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
- Enter anchor, viewport. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.left, result.right, result.top, result.bottom. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Validate anchor and viewport as origin/extent rectangles. Return each anchor-to-corresponding-viewport-edge gap for left, right, top and bottom.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| anchor | anchor. | List of finite numbers; bounded by the operation |
| viewport | viewport. | List of finite numbers; bounded by the operation |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.left | The left value under the stated formula or text convention. |
| result.right | The right value under the stated formula or text convention. |
| result.top | The top value under the stated formula or text convention. |
| result.bottom | The bottom value under the stated formula or text convention. |
{
"input": {
"anchor": [
4,
4,
2,
2
],
"viewport": [
0,
0,
10,
10
]
},
"output": {
"result": {
"left": 4,
"right": 4,
"top": 4,
"bottom": 4
}
}
} Limitations and assumptions
- Negative values indicate the anchor extends beyond that edge. No popup dimensions, placement choice or occlusion is considered.
- 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
Similar or alternative tools
- Fixed Row Visible Index Range
Plan half-open visible fixed-row indexes with positive geometric intersection; exact end contacts are excluded and empty viewports contain no rows.
- 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.