lib/leaflet.js
function (center, zoom, bounds) {

		if (!bounds) { return center; }

		var centerPoint = this.project(center, zoom),
		    viewHalf = this.getSize().divideBy(2),
		    viewBounds = new L.Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
		    offset = this._getBoundsOffset(viewBounds, bounds, zoom);

		// If offset is less than a pixel, ignore.
		// This prevents unstable projections from getting into
		// an infinite loop of tiny offsets.
		if (offset.round().equals([0, 0])) {
			return center;
		}

		return this.unproject(centerPoint.add(offset), zoom);
	}
function (center, zoom, bounds) {

		if (!bounds) { return center; }

		var centerPoint = this.project(center, zoom),
		    viewHalf = this.getSize().divideBy(2),
		    viewBounds = new L.Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
		    offset = this._getBoundsOffset(viewBounds, bounds, zoom);

		// If offset is less than a pixel, ignore.
		// This prevents unstable projections from getting into
		// an infinite loop of tiny offsets.
		if (offset.round().equals([0, 0])) {
			return center;
		}

		return this.unproject(centerPoint.add(offset), zoom);
	}
function ( center , zoom , bounds ) { if ( ! bounds ) { return center ; } var centerPoint = this . project ( center , zoom ) , viewHalf = this . getSize ( ) . divideBy ( 2 ) , viewBounds = new L . Bounds ( centerPoint . subtract ( viewHalf ) , centerPoint . add ( viewHalf ) ) , offset = this . _getBoundsOffset ( viewBounds , bounds , zoom ) ; // If offset is less than a pixel, ignore.
 // This prevents unstable projections from getting into
 // an infinite loop of tiny offsets.
 if ( offset . round ( ) . equals ( [ 0 , 0 ] ) ) { return center ; } return this . unproject ( centerPoint . add ( offset ) , zoom ) ; }
adjust center for view to get inside bounds
adjust center for view to get inside bounds