positionComputation property

(Point Function(Diagram, Point)?) positionComputation

Gets or sets the function used to determine the position that this Diagram can be scrolled or moved to.

By default this function is null and the Diagram's position is bound only by the document bounds.

When this property is set the function is given a reference to the diagram and the proposed new position Point. The function must return a new point.

An example that disallows decimal position values:

  function computeIntegralPosition(diagram, pt) {
    return new go.Point(Math.floor(pt.x), Math.floor(pt.y));
  }

The function, if supplied, must not have any side-effects.

Implementation

_i3.Point Function(
  _i3.Diagram,
  _i3.Point,
)? get positionComputation => (
      _i3.Diagram p0,
      _i3.Point p1,
    ) =>
        _i4.callMethod(
          _i4.getProperty(
            this,
            'positionComputation',
          ),
          r'call',
          [
            this,
            p0,
            p1,
          ],
        );
void positionComputation=(Point value(Diagram, Point)?)

Implementation

set positionComputation(
    _i3.Point Function(
      _i3.Diagram,
      _i3.Point,
    )? value) {
  _i4.setProperty(
    this,
    'positionComputation',
    value == null ? _i5.undefined : _i4.allowInterop(value),
  );
}