Skip to content

Commit 880fba1

Browse files
[fix] ...兼容打包 review by xiongjj
1 parent bffe1e5 commit 880fba1

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/mapboxgl/overlay/GraticuleLayer.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,13 @@ export class GraticuleLayer {
244244

245245
_initialize(map = this.map, options = this.options) {
246246
options = options || {};
247-
options.strokeStyle = { ...defaultStrokeStyle, ...(options.strokeStyle || {}) };
248-
options.lngLabelStyle = { ...defaultTextStyle, ...(options.lngLabelStyle || {}) };
249-
options.latLabelStyle = { ...defaultTextStyle, ...(options.latLabelStyle || {}) };
250-
this.options = {
251-
...defaultOptions,
252-
...options,
247+
options.strokeStyle = Object.assign({}, defaultStrokeStyle, options.strokeStyle || {});
248+
options.lngLabelStyle = Object.assign({}, defaultTextStyle, options.lngLabelStyle || {});
249+
options.latLabelStyle = Object.assign({}, defaultTextStyle, options.latLabelStyle || {});
250+
this.options = Object.assign({}, defaultOptions, options, {
253251
extent: this._getDefaultExtent(options.extent, map),
254252
wrapX: typeof options.wrapX === 'boolean' ? options.wrapX : map.getRenderWorldCopies()
255-
};
253+
});
256254
this.oldExtent = this.options.extent;
257255
this._calcInterval();
258256
this.isRotate = false;
@@ -711,12 +709,11 @@ export class GraticuleLayer {
711709
}
712710

713711
if (!this.map.getLayer(this.sourceId)) {
714-
this.map.addLayer({
715-
id: this.sourceId,
716-
type: 'line',
717-
source: this.sourceId,
718-
...this._transformStrokeStyle()
719-
});
712+
const layer = Object.assign(
713+
{ id: this.sourceId, type: 'line', source: this.sourceId },
714+
this._transformStrokeStyle()
715+
);
716+
this.map.addLayer(layer);
720717
}
721718
}
722719

@@ -793,7 +790,11 @@ export class GraticuleLayer {
793790
const intNumber = Math.floor(extent[2] / this._currLngInterval);
794791
extent[2] = intNumber * this._currLngInterval;
795792
}
796-
return { latRange: [extent[1], extent[3]], lngRange: [extent[0], extent[2]], extent, ...realExtent };
793+
const result = Object.assign(
794+
{ latRange: [extent[1], extent[3]], lngRange: [extent[0], extent[2]], extent },
795+
realExtent
796+
);
797+
return result;
797798
}
798799

799800
_makeLineCoords(fixedDegree, range = [-90, 90], first, last, type = 'lng') {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy