1
我試圖在配置文件頁面上使用小冊子(https://github.com/gabesmed/ember-leaflet)。問題在於將特徵放入圖層中。任何有關如何最好地將與中心功能相同的座標添加到「圖層」的建議。添加功能的小冊子
嘗試在childLayers中創建一個函數,該函數返回一個帶有座標的新圖層,但隨後會發出一個錯誤。
var MarkerLayer =
EmberLeaflet.MarkerLayer.extend(
EmberLeaflet.PopupMixin, {
popupContentBinding: 'content.title'
});
var MarkerCollectionLayer = EmberLeaflet.MarkerCollectionLayer.extend({
contentBinding: 'controller',
itemLayerClass: MarkerLayer
});
var layer = EmberLeaflet.MarkerCollectionLayer.extend({
content: [
{location: L.latLng(63.429722, 10.393333)},
{location: L.latLng(40.721, -73.991)}]});
export default EmberLeaflet.MapView.extend({
latitude: 61,
longitude: 8,
center: function() {
console.log(get(this, 'latitude'));
var latitude = get(this, 'latitude');
var longitude = get(this, 'longitude');
return L.latLng(latitude, longitude);
}.property("latitude", "longitude"),
zoom: 16,
options: {maxZoom: 19, minZoom: 7},
childLayers: [
WMSLayer,
MarkerCollectionLayer,
layer
]
});