Contents

constrainScroll(_:)

Returns a scroll point adjusted from the proposed new origin, if necessary, to guarantee the view will lie within its document view.

Declaration

func constrainScroll(_ newOrigin: NSPoint) -> NSPoint

Parameters

  • newOrigin:

    Origin proposed.

Return Value

A point which will guarantee the view will lie within its document view.

Discussion

For example, if the x-coordinate of newOrigin lies to the left of the document view’s origin, then the x-coordinate returned is set to that of the x-coordinate of the document view’s origin.

See Also

Scrolling