git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_3.0.1@80 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
call uglifyjs .\js\libs\hello.min.js .\js\libs\ua-parser.min.js -o .\js\common.min.js
|
call uglifyjs .\js\libs\hello.min.js .\js\libs\ua-parser.min.js .\js\libs\markerclusterer.js -o .\js\common.min.js
|
||||||
REM node r.js -o app.build_dev.js
|
REM node r.js -o app.build_dev.js
|
||||||
node r.js -o app.build_prod.js
|
node r.js -o app.build_prod.js
|
||||||
REM call cleancss -o .\css\loadingStyle.min.css .\css\loadingStyle.css
|
REM call cleancss -o .\css\loadingStyle.min.css .\css\loadingStyle.css
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
var myManifest = {
|
var myManifest = {
|
||||||
Debug: (window.location.port !== ""),
|
Debug: (window.location.port !== ""),
|
||||||
Name: "Il Lievitario",
|
Name: "Il Lievitario",
|
||||||
Version: "3.0.4.3",
|
Version: "3.0.5.2",
|
||||||
Author: "Denis Ironi",
|
Author: "Denis Ironi",
|
||||||
Settings: {
|
Settings: {
|
||||||
ShowStartMessage: true,
|
ShowStartMessage: true,
|
||||||
|
|||||||
+73
-32
@@ -5,6 +5,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
|
|
||||||
map: null,
|
map: null,
|
||||||
markers: [],
|
markers: [],
|
||||||
|
openedInfoWindows: [],
|
||||||
|
markerClicked: false,
|
||||||
//initialize template
|
//initialize template
|
||||||
template: _.template(mapsViewTemplate),
|
template: _.template(mapsViewTemplate),
|
||||||
infoWindowtemplate: _.template(infoWindowTemplate),
|
infoWindowtemplate: _.template(infoWindowTemplate),
|
||||||
@@ -76,12 +78,16 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
mapTypeControl: false,
|
mapTypeControl: false,
|
||||||
zoomControlOptions: {
|
zoomControlOptions: {
|
||||||
position: google.maps.ControlPosition.RIGHT_CENTER
|
position: google.maps.ControlPosition.RIGHT_CENTER
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
self.$el.find("#map-canvas").width(document.documentElement.clientWidth - 32/*Padding content*/);
|
self.$el.find("#map-canvas").width(document.documentElement.clientWidth - 32/*Padding content*/);
|
||||||
self.$el.find("#map-canvas").height(document.documentElement.clientHeight - 151 - self.$el.find('#searchPanel').height());
|
self.$el.find("#map-canvas").height(document.documentElement.clientHeight - 151 - self.$el.find('#searchPanel').height());
|
||||||
self.map = new google.maps.Map(self.$el.find("#map-canvas")[0], myOptions);
|
self.map = new google.maps.Map(self.$el.find("#map-canvas")[0], myOptions);
|
||||||
|
|
||||||
|
self.map.addListener("dragend", function(){
|
||||||
|
self.markerClicked = true;
|
||||||
|
});
|
||||||
|
|
||||||
// Create the search box and link it to the UI element.
|
// Create the search box and link it to the UI element.
|
||||||
var input = $('<input id="pac-input" data-role="none" class="controls" type="text" placeholder="Ricerca località..." style="display:none;">')[0];
|
var input = $('<input id="pac-input" data-role="none" class="controls" type="text" placeholder="Ricerca località..." style="display:none;">')[0];
|
||||||
self.$el.find('div[data-role="content"]')[0].appendChild(input);
|
self.$el.find('div[data-role="content"]')[0].appendChild(input);
|
||||||
@@ -140,32 +146,47 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
|
|
||||||
self.map.addListener('bounds_changed', function() {
|
self.map.addListener('bounds_changed', function() {
|
||||||
var bound = self.map.getBounds();
|
var bound = self.map.getBounds();
|
||||||
searchBox.setBounds(bound);
|
searchBox.setBounds(bound);
|
||||||
var latLngFrom = bound.getNorthEast();
|
|
||||||
var latLngTo = bound.getSouthWest();
|
|
||||||
$.ajax({
|
|
||||||
url: myManifest.Settings.DefaultURL + "/api/spacciatori/bound/" + latLngFrom.lat() + "/"+ latLngFrom.lng() + "/" + latLngTo.lat() + "/"+ latLngTo.lng(),
|
|
||||||
//dataType: "json",
|
|
||||||
//async: false,
|
|
||||||
type: 'GET',
|
|
||||||
success: function (resp) {
|
|
||||||
resp.forEach(function(ele, index){
|
|
||||||
var key = "|" + ele.Latitudine+ "|" + ele.Longitudine+ "|";
|
|
||||||
if(!self.markers[key])
|
|
||||||
{
|
|
||||||
self._makeMarker(ele, key);
|
|
||||||
}
|
|
||||||
else if(!self.markers[key][ele.ID])
|
|
||||||
{
|
|
||||||
ele.Latitudine = parseFloat(ele.Latitudine) + (Math.random() / 500);
|
|
||||||
ele.Longitudine = parseFloat(ele.Longitudine) + (Math.random() / 500);
|
|
||||||
self._makeMarker(ele, key);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$("#pac-input").show();
|
$("#pac-input").show();
|
||||||
|
|
||||||
|
var markersArray = [];
|
||||||
|
var latLngFrom = new google.maps.LatLng(85, -180);
|
||||||
|
var latLngTo = new google.maps.LatLng(-85, 180);
|
||||||
|
$.ajax({
|
||||||
|
url: myManifest.Settings.DefaultURL + "/api/spacciatori/bound/" + latLngFrom.lat() + "/"+ latLngFrom.lng() + "/" + latLngTo.lat() + "/"+ latLngTo.lng(),
|
||||||
|
//dataType: "json",
|
||||||
|
//async: false,
|
||||||
|
type: 'GET',
|
||||||
|
success: function (resp) {
|
||||||
|
resp.forEach(function(ele, index){
|
||||||
|
var key = "|" + ele.Latitudine+ "|" + ele.Longitudine+ "|";
|
||||||
|
if(!self.markers[key])
|
||||||
|
{
|
||||||
|
markersArray.push(self._makeMarker(ele, key));
|
||||||
|
}
|
||||||
|
else if(!self.markers[key][ele.ID])
|
||||||
|
{
|
||||||
|
ele.Latitudine = parseFloat(ele.Latitudine) + (Math.random() / 500);
|
||||||
|
ele.Longitudine = parseFloat(ele.Longitudine) + (Math.random() / 500);
|
||||||
|
markersArray.push(self._makeMarker(ele, key));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
markerClusterer = new MarkerClusterer(self.map, markersArray, {
|
||||||
|
maxZoom: 15
|
||||||
|
// ,styles: {
|
||||||
|
// url: '../images/pin.png',
|
||||||
|
// height: 48,
|
||||||
|
// width: 30,
|
||||||
|
// anchor: [-18, 0],
|
||||||
|
// textColor: '#ffffff',
|
||||||
|
// textSize: 10,
|
||||||
|
// iconAnchor: [15, 48]
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
_makeMarker: function(ele,key){
|
_makeMarker: function(ele,key){
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -174,7 +195,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
icon: ele.TipoPM == "4"?self.iconPMGF:self.iconPM,
|
icon: ele.TipoPM == "4"?self.iconPMGF:self.iconPM,
|
||||||
//label: ele.Name,
|
//label: ele.Name,
|
||||||
title: $("<div/>").html(unescape(ele.Name)).text(),
|
title: $("<div/>").html(unescape(ele.Name)).text(),
|
||||||
map: self.map
|
//map: self.map
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!self.markers[key])
|
if(!self.markers[key])
|
||||||
@@ -183,26 +204,34 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
self.markers[key][ele.ID] = marker;
|
self.markers[key][ele.ID] = marker;
|
||||||
|
|
||||||
var infowindow = new google.maps.InfoWindow({
|
var infowindow = new google.maps.InfoWindow({
|
||||||
content: self.infoWindowtemplate({item: ele})
|
content: self.infoWindowtemplate({item: ele}),
|
||||||
|
closeclick: function(){
|
||||||
|
var index = openedInfoWindows.indexOf(this);
|
||||||
|
if (index > -1) {
|
||||||
|
self.openedInfoWindows.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
marker.addListener('click', function() {
|
marker.addListener('click', function() {
|
||||||
|
self.markerClicked = true;
|
||||||
|
self.openedInfoWindows.push(infowindow);
|
||||||
infowindow.open(self.map, marker);
|
infowindow.open(self.map, marker);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return marker;
|
||||||
},
|
},
|
||||||
onShowed: function(){
|
onShowed: function(){
|
||||||
if(this.map)
|
if(this.map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$( window ).resize( function(){
|
$( window ).resize( function(){
|
||||||
$("#map-canvas").width(document.documentElement.clientWidth - 32/*Padding content*/);
|
$("#map-canvas").width(document.documentElement.clientWidth - 32/*Padding content*/);
|
||||||
$("#map-canvas").height(document.documentElement.clientHeight - 151 - self.$el.find('#searchPanel').height());
|
$("#map-canvas").height(document.documentElement.clientHeight - 151 - self.$el.find('#searchPanel').height());
|
||||||
});
|
});
|
||||||
},
|
|
||||||
onShowing: function(){
|
|
||||||
var self = this;
|
|
||||||
if ( navigator.geolocation ) {
|
if ( navigator.geolocation ) {
|
||||||
function success(pos) {
|
function success(pos) {
|
||||||
// Location found, show map with these coordinates
|
// Location found, show map with these coordinates
|
||||||
@@ -216,6 +245,18 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
} else {
|
} else {
|
||||||
self._drawMap(self.defaultLatLng); // No geolocation support, show default map
|
self._drawMap(self.defaultLatLng); // No geolocation support, show default map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#map-canvas").click(function(){
|
||||||
|
if(self.markerClicked){
|
||||||
|
self.markerClicked = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self.openedInfoWindows.forEach(function(item, index){
|
||||||
|
item.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.openedInfoWindows = [];
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onClosing: function(){
|
onClosing: function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user