Skip to content

Commit ac9399d

Browse files
committed
baidu 支持高分屏
1 parent fa148e3 commit ac9399d

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

dist/iclient9-leaflet.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,17 @@
130130
minZoom: 3,
131131
maxZoom: 19,
132132
bounds: L.latLngBounds(L.latLng(-85.0511287798, -180), L.latLng(85.0511287798, 180)),
133-
detectRetina: L.Browser.retina
133+
retina: L.Browser.retina,
134134
},
135135
initialize: function (url, options) {
136+
if (url) {
137+
this.url = url;
138+
}
136139
L.setOptions(this, options);
137-
L.TileLayer.prototype.initialize.call(this, url, options)
140+
if (this.options.retina) {
141+
this.options.maxZoom = 18;
142+
}
143+
L.stamp(this);
138144
},
139145
getTileUrl: function (coords) {
140146
return L.Util.template(this.url, {

examples/leaflet/baiduLayer.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
<script type="text/javascript">
1414
map = L.map('map', {
1515
center: [0, 0],
16-
maxZoom: 21,
17-
minZoom: 3,
1816
zoom: 3,
1917
crs: L.CRS.BaiduCRS
2018
});

src/Leaflet/mapping/BaiduTileLayer.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ BaiduTileLayer = L.TileLayer.extend({
44
minZoom: 3,
55
maxZoom: 19,
66
bounds: L.latLngBounds(L.latLng(-85.0511287798, -180), L.latLng(85.0511287798, 180)),
7-
detectRetina: L.Browser.retina
7+
retina: L.Browser.retina,
88
},
99
initialize: function (url, options) {
10+
if (url) {
11+
this.url = url;
12+
}
1013
L.setOptions(this, options);
11-
L.TileLayer.prototype.initialize.call(this, url, options)
14+
if (this.options.retina) {
15+
this.options.maxZoom = 18;
16+
}
17+
L.stamp(this);
1218
},
1319
getTileUrl: function (coords) {
1420
return L.Util.template(this.url, {

0 commit comments

Comments
 (0)