Contents

rulerView(_:willMove:toLocation:)

Returns a potentially modified location to which the marker should be moved.

Declaration

func rulerView(_ ruler: NSRulerView, willMove marker: NSRulerMarker, toLocation location: CGFloat) -> CGFloat

Parameters

  • ruler:

    The ruler view sending the message.

  • marker:

    The marker to be moved.

  • location:

    The new location for the marker, in the ruler view’s coordinates.

Return Value

The modified location to which the marker should be moved.

Discussion

This method ensures that the proposed location of aMarker lies within the appropriate bounds for the receiver’s text container. Appropriate bounds are those of the text container minus its line fragment padding.

Typically, the ruler view’s width matches that of its text view.

See Also

Supporting the ruler view