diff options
| author | Code WvS <code-wvs@quantentunnel.de> | 2015-02-07 11:26:06 +0100 |
|---|---|---|
| committer | Code WvS <code-wvs@quantentunnel.de> | 2015-02-07 11:26:06 +0100 |
| commit | 84216b2822f4949b41495053ab4d4b92590930bb (patch) | |
| tree | 6270e8e5ea71b0bb9d41e5353da8baf2ed9ed01a /threads.js | |
| parent | 2f9d77be645e90fc58779141ecf5a8c906736ec9 (diff) | |
| download | snap-yow-84216b2822f4949b41495053ab4d4b92590930bb.tar.gz snap-yow-84216b2822f4949b41495053ab4d4b92590930bb.zip | |
add leaflet images; replace motion category by "map" and add blocks
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -2626,6 +2626,54 @@ Process.prototype.reportTimer = function () { return 0; }; +Process.prototype.reportLocation = function (name) { + var myself = this; + + if (!myself.context.position) { + myself.context.position = []; + + if (!navigator.geolocation) { + myself.handleError({name: 'Location', + message: 'navigator.geolocation is not supported'}); + } + + navigator.geolocation.getCurrentPosition( + function (pos) { + myself.context.position = [ + pos.coords.latitude, pos.coords.longitude]; + }, + function (err) { + console.log(err); + myself.handleError({name: 'Location', message: err.message}); + }, + { enableHightAccuracy: true, timeout: 5000, maximumAge: 0} + ); + } else { + if (myself.context.position.length == 2) { + return new List(myself.context.position); + } + } + + this.pushContext('doYield'); + this.pushContext(); +}; + +Process.prototype.focusMap = function (pos, zoom) { + if (pos.contents.length != 2) { + this.handleError({name: 'Location', + message: 'expecting a list of latitude/longitude'}); + } + window.map.setView(pos.contents, zoom); +}; + +Process.prototype.addMarker = function (pos) { + if (pos.contents.length != 2) { + this.handleError({name: 'Location', + message: 'expecting a list of latitude/longitude'}); + } + L.marker(pos.contents).addTo(window.map); +}; + // Process Dates and times in Snap // Map block options to built-in functions var dateMap = { |
