findObjectsNear<T extends GraphObject, S extends Iterable<T>> method

S findObjectsNear<T extends GraphObject, S extends Iterable<T>>(
  1. Point p,
  2. num dist, [
  3. T? navig(
    1. GraphObject
    )?,
  4. bool pred(
    1. T
    )?,
  5. Object? partialInclusion,
  6. S? coll,
])

Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates.

If Layer#visible is false, this method will not find any objects in that layer. However, Layer#opacity does not affect this method.

Example usage:

// Returns the Nodes that intersect a given circular area and have a certain data property
myDiagram.findObjectsNear(somePoint,
  // The circular area is centered at somePoint and has radius 100
  100,
  // Navigation function -- only return Nodes
  x => { const p = x.part; return (p instanceof go.Node) ? p : null; },
  // Predicate that always receives a Node, due to above navigation function
  node => node.data.someProp > 17,
  // the nodes may only partly overlap the given circular area
  true
);

@param {Point} p A Point in document coordinates. @param {number} dist The distance from the point. @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results. @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true. @param {*=} partialInclusion Whether an object can match if it merely intersects the circular area (true) or if it must be entirely inside the circular area (false). The default value is true. The default is true. @param {List.

Implementation

S findObjectsNear<T extends _i3.GraphObject, S extends _i3.Iterable<T>>(
  _i3.Point p,
  _i2.num dist, [
  T? Function(_i3.GraphObject)? navig,
  _i2.bool Function(T)? pred,
  _i2.Object? partialInclusion,
  S? coll,
]) =>
    _i4.callMethod(
      this,
      'findObjectsNear',
      [
        p,
        dist,
        navig == null
            ? _i5.undefined
            : _i4.allowInterop((p0) => () => navig(p0) ?? _i5.undefined),
        pred == null ? _i5.undefined : _i4.allowInterop(pred),
        partialInclusion ?? _i5.undefined,
        coll ?? _i5.undefined,
      ],
    );