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

S findObjectsIn<T extends GraphObject, S extends Iterable<T>>(
  1. Rect r, [
  2. T? navig(
    1. GraphObject
    )?,
  3. bool pred(
    1. T
    )?,
  4. bool? partialInclusion,
  5. S? coll,
])

Returns a collection of all GraphObjects that are inside or that intersect a given Rect 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 Links that intersect a given rectangle and have a certain data property
myDiagram.findObjectsIn(someRect,
  // Navigation function -- only return Links
  x => { const p = x.part; return (p instanceof go.Link) ? p : null; },
  // Predicate that always receives a Link, due to above navigation function
  link => link.data.someProp > 17,
  // the links may only partly overlap the given rectangle
  true
);

@param {Rect} r A Rect in document coordinates. @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 {boolean=} partialInclusion Whether an object can match if it merely intersects the rectangular area (true) or if it must be entirely inside the rectangular area (false). The default value is false. @param {List.

Implementation

S findObjectsIn<T extends _i3.GraphObject, S extends _i3.Iterable<T>>(
  _i3.Rect r, [
  T? Function(_i3.GraphObject)? navig,
  _i2.bool Function(T)? pred,
  _i2.bool? partialInclusion,
  S? coll,
]) =>
    _i4.callMethod(
      this,
      'findObjectsIn',
      [
        r,
        navig == null
            ? _i5.undefined
            : _i4.allowInterop((p0) => () => navig(p0) ?? _i5.undefined),
        pred == null ? _i5.undefined : _i4.allowInterop(pred),
        partialInclusion ?? _i5.undefined,
        coll ?? _i5.undefined,
      ],
    );