/// <summary> /// Checks if a given PageSpaceTaker is contained into the AvailableSpace. /// </summary> /// <param name="space_taker">PageSpaceTaker to check.</param> /// <returns>True if the given parameter is contained into current AvailableSpace.</returns> public bool Contains(PageSpaceTaker space_taker) { if (space_taker.origin.x >= origin.x && space_taker.origin.x + space_taker.size.x <= origin.x + size.x) { if (space_taker.origin.y >= origin.y && space_taker.origin.y + space_taker.size.y <= origin.y + size.y) { return(true); } } return(false); }
/// <summary> /// Checks if a given PageSpaceTaker object can fit into the AvailableSpace. /// </summary> /// <param name="item">The PageSpaceTaker to fit in.</param> /// <returns>True if given PageSpaceTaker can fit, False otherwise.</returns> public bool CanFit(PageSpaceTaker item) { return(item.size.x <= size.x && item.size.y <= size.y); }