Skip to content

Commit fcec2b6

Browse files
committed
【SDK】【Leaflet】【修复maplayer瓦片尺寸修改在地图上未生效的问题】
1 parent 219c9ac commit fcec2b6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/leaflet/layer/MapLayer.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {newGuid} from '../../service/common/Util';
1+
import { newGuid } from '../../service/common/Util';
22
import { L } from '../core/Base.js';
33

44
/**
@@ -39,7 +39,7 @@ var MapLayer = L.TileLayer.extend({
3939
imageFormat: null,
4040
imageHeight: 512,
4141
imageWidth: 512,
42-
guid:null,
42+
guid: null,
4343
imageTransparent: null,
4444
filters: null,
4545
styles: null,
@@ -69,6 +69,10 @@ var MapLayer = L.TileLayer.extend({
6969
*/
7070
initialize: function (url, options) {
7171
this.url = encodeURI(url + '/image');
72+
var imageHeight = options.imageHeight || 512;
73+
var imageWidth = options.imageWidth || 512;
74+
options.tileSize = window.L.point(imageWidth, imageHeight);
75+
// console.log('maplayer_initialize', options);
7276
L.TileLayer.prototype.initialize.apply(this, arguments);
7377
L.setOptions(this, options);
7478
L.stamp(this);
@@ -93,19 +97,21 @@ var MapLayer = L.TileLayer.extend({
9397
var layerUrl = vm.url + '?';
9498
layerUrl += encodeURI(vm._initAllRequestParams().join('&'));
9599
this._layerUrl = layerUrl;
100+
// console.log('maplayer__initLayerUrl', layerUrl);
96101
},
97102

98103
_initAllRequestParams: function () {
99104
var vm = this,
100105
options = vm.options || {},
101106
params = [];
102107

103-
var imageHeight = this.options.imageHeight;
104-
var imageWidth = this.options.imageWidth;
108+
// console.log('maplayer_initAllRequestParams', options);
109+
var imageHeight = options.imageHeight || 512;
110+
var imageWidth = options.imageWidth || 512;
105111
params.push('size=' + imageWidth + ',' + imageHeight);
106112

107113
var guid = options.guid || newGuid();
108-
params.push("clientId=" + guid);
114+
params.push('clientId=' + guid);
109115

110116
if (options.imageFormat) {
111117
params.push('format=' + options.imageFormat);

0 commit comments

Comments
 (0)