-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
/nbproject/private/ | ||
/nbproject/customs.json | ||
/nbproject/project.properties | ||
/nbproject/project.xml | ||
/nbproject/ | ||
/src/bower_components/ | ||
/src/demo/bower_components/ | ||
/dist/ | ||
/nbproject/private/ | ||
/nbproject/customs.json | ||
/nbproject/project.properties | ||
/nbproject/project.xml | ||
/nbproject/ | ||
/src/bower_components/ | ||
/src/demo/bower_components/ | ||
/dist/ | ||
/bower_components/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
{"name": "Maps for HTML Community Group", "email": "[email protected]", "homepage": "https://www.w3.org/community/maps4html/"} | ||
], | ||
"homepage": "http://maps4html.github.io/Web-Map-Custom-Element/", | ||
"license": "W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE", | ||
"license": "W3C", | ||
"keywords": [ | ||
"framework", | ||
"web-components", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<dom-module id="device-location"> | ||
<script> | ||
|
||
Polymer({ | ||
is: "device-location", | ||
properties: { | ||
lat : { | ||
type: Number, | ||
value: 0, | ||
reflectToAttribute: false | ||
}, | ||
lon : { | ||
type: Number, | ||
value: 0, | ||
reflectToAttribute: false | ||
}, | ||
centered : { | ||
type: Boolean, | ||
reflectToAttribute: true | ||
} | ||
}, | ||
observers: [ | ||
'_toggleCentered(centered)' | ||
], | ||
_toggleCentered: function (centered) { | ||
if (centered) { | ||
// TODO create a point feature on the controls pane at the map center | ||
// DONE register a watchPosition function to move the map as the device | ||
// location changes | ||
var self = this, | ||
options = { | ||
enableHighAccuracy: true, | ||
timeout: 5000, | ||
maximumAge: 0 | ||
}; | ||
function moveTo(position) { | ||
self.lat = position.coords.latitude; | ||
self.lon = position.coords.longitude; | ||
if (self.parentNode.zoomTo && self.parentNode._map) { | ||
// TODO when the zoomTo bug is fixed, remove zoom+1 | ||
self.parentNode.zoomTo(self.lat,self.lon,self.parentNode.zoom+1); | ||
} | ||
}; | ||
this._watchID = navigator.geolocation.watchPosition(moveTo,null,options); | ||
} else { | ||
this._deleteWatch(); | ||
// TODO replace the marker on the control pane at the center of the map | ||
// with an actual point feature , or simply move that point from | ||
// the control pane to the vector pane | ||
|
||
// TODO register a navigator.geolocation.watchPosition function to | ||
// update the location of the above point feature | ||
} | ||
}, | ||
detached: function() { | ||
this._deleteWatch(); | ||
// TODO if there is a point associated to this control, remove/delete it | ||
}, | ||
ready: function() { | ||
if (this.centered) { | ||
var self = this, | ||
options = { | ||
enableHighAccuracy: true, | ||
timeout: 5000, | ||
maximumAge: 0 | ||
}; | ||
function moveTo(position) { | ||
self.lat = position.coords.latitude; | ||
self.lon = position.coords.longitude; | ||
if (self.parentNode.zoomTo && self.parentNode._map) { | ||
// TODO when the zoomTo bug is fixed, remove zoom+1 | ||
self.parentNode.zoomTo(self.lat,self.lon,self.parentNode.zoom+1); | ||
} | ||
}; | ||
this._watchID = navigator.geolocation.watchPosition(moveTo,null,options); | ||
} | ||
}, | ||
// attached: function() { | ||
// this._deleteWatch(); | ||
// // could have a _watchID from being created without being detached | ||
// // i.e. never having been attached before... | ||
// if (this.centered) { | ||
// // create point on the control layer at the map center... | ||
// | ||
// } | ||
// | ||
// }, | ||
_deleteWatch: function() { | ||
if (this._watchID) { | ||
navigator.geolocation.clearWatch(this._watchID); | ||
delete this._watchID; | ||
} | ||
} | ||
}); | ||
</script> | ||
</dom-module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters