get_visible_nodes

The nodes the last presented frame shows, from its ID pass at full resolution (so it agrees with pick): { viewport (CSS px), total, nodes: [{ nodeId, pixels, fraction, bboxPx (CSS px), depthApprox: { min, mean }, touchesEdge }] }, the largest limit (1..1000, default 50) by pixels, then nodeId. Hidden and x-ray-flagged nodes are not counted. depthApprox is eye distance from GPU depth: display data, never a measurement.

QueryAsync

Usage

TypeScript
await surface.queryAsync('get_visible_nodes', { limit? })

Parameters

  • limitinteger

    Optional

Returns

object with viewport, total, nodes, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "number"
        },
        "height": {
          "type": "number"
        }
      },
      "required": [
        "width",
        "height"
      ]
    },
    "total": {
      "type": "integer",
      "minimum": 0
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "nodeId": {
            "type": "string"
          },
          "pixels": {
            "type": "integer",
            "minimum": 0
          },
          "fraction": {
            "type": "number"
          },
          "bboxPx": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              },
              "width": {
                "type": "number"
              },
              "height": {
                "type": "number"
              }
            },
            "required": [
              "x",
              "y",
              "width",
              "height"
            ]
          },
          "depthApprox": {
            "type": "object",
            "properties": {
              "min": {
                "type": "number"
              },
              "mean": {
                "type": "number"
              }
            },
            "required": [
              "min",
              "mean"
            ]
          },
          "touchesEdge": {
            "type": "boolean"
          }
        },
        "required": [
          "nodeId",
          "pixels",
          "fraction",
          "bboxPx",
          "depthApprox",
          "touchesEdge"
        ]
      }
    }
  },
  "required": [
    "viewport",
    "total",
    "nodes"
  ]
}

See also