ImageGear.Web.UI Namespace Client API Library > ImageGear.Web.UI Namespace > Point class : constrain Method |
ASP.NET Ajax Javascript (Usage) | |
---|---|
var resultVar = instanceOfPoint.constrain(Rectangle); |
The function will modify this object so that the point lies within the bounds of the specified rectangle. The resulting point will be as close as possible to the original point, while still lying inside the specified rectangle.
There are two exceptions to the defined behavior of this function: points along the bottom and right edges. Technically, a rectangle contains all the points whose x coordinate is greater than or equal to the left edge and less than the right edge and whose y coordinate is greater than or equal to the top edge and less than the bottom edge. To simplify the implementation of this function, it may select a point whose x coordinate is equal to (not less than) the right edge or whose y coordinate is equal to (not less than) the bottom edge.