kosmtik-geojson-overlay
Advanced tools
Comparing version 0.0.1 to 0.0.2
39
front.js
@@ -13,3 +13,3 @@ L.K.Map.addInitHook(function () { | ||
color: '#F89406', | ||
weight: 3, | ||
weight: 3 | ||
}, | ||
@@ -20,2 +20,14 @@ params = { | ||
}, | ||
builder = new L.K.FormBuilder(params, [ | ||
['active', {handler: L.K.Switch, label: 'Active (ctrl+alt+G)'}], | ||
['data', {handler: 'Textarea', placeholder: 'Paste your geojson here.'}] | ||
], {id: 'geojson-overlay-form'}), | ||
syncState = function () { | ||
if (params.active) { | ||
this.geojsonOverlay.addTo(this); | ||
} else { | ||
this.removeLayer(this.geojsonOverlay); | ||
} | ||
builder.fetchAll(); | ||
}, | ||
addGeojson = function () { | ||
@@ -34,10 +46,2 @@ var geojson; | ||
}, | ||
syncState = function () { | ||
if (params.active) { | ||
this.geojsonOverlay.addTo(this); | ||
} else { | ||
this.removeLayer(this.geojsonOverlay); | ||
} | ||
builder.fetchAll(); | ||
}, | ||
toggle = function () { | ||
@@ -47,6 +51,5 @@ params.active = !params.active; | ||
}, | ||
builder = new L.K.FormBuilder(params, [ | ||
['active', {handler: L.K.Switch, label: 'Active (ctrl+alt+G)'}], | ||
['data', {handler: 'Textarea', placeholder: 'Paste your geojson here.'}] | ||
], {id: 'geojson-overlay-form'}); | ||
fitBounds = function (e) { | ||
this.fitBounds(this.geojsonOverlay.getBounds()); | ||
}; | ||
title.innerHTML = 'GeoJSON overlay'; | ||
@@ -59,2 +62,5 @@ this.geojsonOverlay = L.geoJson(null, {pointToLayer: pointToLayer, onEachFeature: onEachFeature, style: style}); | ||
container.appendChild(builder.build()); | ||
var zoomTo = L.DomUtil.create('a', 'button', container); | ||
zoomTo.innerHTML = "Zoom to"; | ||
L.DomEvent.on(zoomTo, 'click', L.DomEvent.stop).on(zoomTo, 'click', fitBounds, this); | ||
this.sidebar.addTab({ | ||
@@ -64,3 +70,3 @@ label: 'GeoJSON', | ||
content: container, | ||
callback: function () {builder.helpers.data.input.focus();}, | ||
callback: function () {builder.helpers.data.input.focus();} | ||
}); | ||
@@ -80,3 +86,8 @@ this.commands.add({ | ||
}); | ||
this.commands.add({ | ||
callback: fitBounds, | ||
context: this, | ||
name: 'GeoJSON overlay: zoom to' | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "kosmtik-geojson-overlay", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Show a geojson overlay on top of your Kosmtik map", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4432
89