Skip to content

Commit

Permalink
Indicatore posizione utente migliorato
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdi2005 committed Jul 9, 2020
1 parent 4d916a1 commit c6d206f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
13 changes: 2 additions & 11 deletions app/controllers/home/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Arguments passed into this controller can be accessed via the `$.args` object directly or:
const Map = require('ti.map');
$.mapview.height = Ti.UI.FILL;
$.searchfield.hide();
$.searchfield.autocorrect = false;
$.activityIndicator.hide();
$.mapview.mapType = Map.NORMAL_TYPE;
function findmon(e, type, latkeep, latdelta, londelta) {
if (latkeep != true) {
var latdelta = 0.1;
Expand All @@ -14,17 +14,10 @@ function findmon(e, type, latkeep, latdelta, londelta) {
// TODO: rimuovere le occorrenze di args
if (type == "geoloc") {
if (Ti.Geolocation.locationServicesEnabled && (e.coords != null || undefined) && (e.coords.latitude != null || undefined)) {
$.mapview.removeAllCircles();
lat = args.coords.latitude;
lon = args.coords.longitude;
url = 'https://cerca.wikilovesmonuments.it/monuments.json?latitude=' + lat + '&longitude=' + lon;
// $.activityIndicator.show();
var circle = $.mapview.addCircle(Map.createCircle({
radius: 50,
center: [e.coords.longitude, e.coords.latitude],
fillColor: "#4289ef",
opacity: '0.4'
}));
$.activityIndicator.show();
} else {
alert('Qualcosa è andato storto! Clicca il tasto refresh per aggironare la mappa e assicurati di aver attivato la localizzazione.');
}
Expand Down Expand Up @@ -54,8 +47,6 @@ function findmon(e, type, latkeep, latdelta, londelta) {
latitudeDelta: latdelta,
longitudeDelta: londelta
};
$.mapview.mapType = Map.NORMAL_TYPE;
$.mapview.height = Ti.UI.FILL;
alert("Non hai inserito nessuna località o c'è stato un errore nella geolocalizzazione.");
}

Expand Down
7 changes: 6 additions & 1 deletion app/styles/home/index.tss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
height: Ti.UI.FILL
}

"#mapview": {
height: Ti.UI.FILL,
userLocation: true
}
"#introd": {
font: {
fontSize: '25px',
Expand Down Expand Up @@ -48,5 +52,6 @@

"#activityIndicator": {
hiddenBehavior: Titanium.UI.HIDDEN_BEHAVIOR_GONE,
style: Ti.UI.ActivityIndicatorStyle.BIG
style: Ti.UI.ActivityIndicatorStyle.BIG,
indicatorColor: 'black'
}

0 comments on commit c6d206f

Please sign in to comment.