Skip to content

Commit

Permalink
fix:fitExtent方法,增加isFraction参数,增加定位支持小数zoom (#2048)
Browse files Browse the repository at this point in the history
Co-authored-by: l2458 <liuxc2458@dtdream.com>
  • Loading branch information
luxiousCoder and l2458 authored Aug 17, 2023
1 parent 5d6bc52 commit 14bf109
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,14 +1026,15 @@ class Map extends Handlerable(Eventable(Renderable(Class))) {
* @param {Number} [options.paddingTop] - Sets the amount of padding in the top of a map container
* @param {Number} [options.paddingRight] - Sets the amount of padding in the right of a map container
* @param {Number} [options.paddingBottom] - Sets the amount of padding in the bottom of a map container
* @param {Boolean} [options.isFraction=false] - can locate to fractional zoom
* @return {Map} - this
*/
fitExtent(extent, zoomOffset, options = {}, step) {
if (!extent) {
return this;
}
extent = new Extent(extent, this.getProjection());
const zoom = this.getFitZoom(extent, false, options) + (zoomOffset || 0);
const zoom = this.getFitZoom(extent, options.isFraction || false, options) + (zoomOffset || 0);
let center = extent.getCenter();
if (this._getPaddingSize(options)) {
center = this._getCenterByPadding(center, zoom, options);
Expand Down

0 comments on commit 14bf109

Please sign in to comment.