Resolver javascript errors with start and end icons

This commit is contained in:
bastianonm 2018-08-06 06:47:55 +00:00
parent 5151dbf37c
commit deb86a08fc
3 changed files with 40 additions and 26 deletions

View File

@ -2,7 +2,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.devfarm.it/ Plugin URI: http://www.devfarm.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.5.05 Version: 1.6.02
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.devfarm.it/ Author URI: http://www.devfarm.it/
*/ */
@ -560,29 +560,30 @@ var WPGPXMAPS = {
if (startIcon != '') if (startIcon != '')
{ {
var startIconImage = new google.maps.MarkerImage(startIcon);
var startMarker = new google.maps.Marker({ var startMarker = L.marker(mapData[0], {icon: L.icon({
position: points[0], iconUrl: startIcon,
map: map, iconSize: [32, 32], // size of the icon
title: "Start", iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
animation: google.maps.Animation.DROP, })
icon: startIconImage, });
zIndex: 10 startMarker.addTo(this.map);
}); startMarker.title = "Start";
} }
if (endIcon != '') if (endIcon != '')
{ {
var endIconImage = new google.maps.MarkerImage(endIcon);
var endMarker = new google.maps.Marker({ var endMarker = L.marker(mapData[ mapData.length - 1 ], {icon: L.icon({
position: points[ points.length -1 ], iconUrl: endIcon,
map: map, iconSize: [32, 32], // size of the icon
title: "Start", iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
animation: google.maps.Animation.DROP, })
icon: endIconImage, });
zIndex: 10 endMarker.addTo(this.map);
}); endMarker.title = "End";
} }
@ -790,7 +791,7 @@ var WPGPXMAPS = {
mapType, mapType,
(zoomOnScrollWheel == 'true'), (zoomOnScrollWheel == 'true'),
ThunderforestApiKey); ThunderforestApiKey);
map.EventSelectChart = function(LatLon) map.EventSelectChart = function(LatLon)
{ {
@ -844,10 +845,21 @@ var WPGPXMAPS = {
if (context.CurrentGPSPositionMarker == null) if (context.CurrentGPSPositionMarker == null)
{ {
context.CurrentGPSPositionMarker = L.marker(pos) if (currentpositioncon == '')
{
currentpositioncon = "https://maps.google.com/mapfiles/kml/pal4/icon25.png";
}
context.CurrentGPSPositionMarker = L.marker(pos, {icon: L.icon({
iconUrl: currentpositioncon,
iconSize: [32, 32], // size of the icon
iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
})
})
.addTo(context.map) .addTo(context.map)
.bindPopup("You are within " + radius + " meters from this point") .bindPopup(lng.currentPosition)
.openPopup(); .openPopup();
} }
else else
{ {
@ -1430,7 +1442,7 @@ var WPGPXMAPS = {
function wpgpxmapsGetDataset(name,data,color, id) { function wpgpxmapsGetDataset(name,data,color, id) {
return { return {
label: name, label: name, // jQuery("<div/>").html(name).text(), // convert html special chars to text, ugly but it works
data : data, data : data,
borderColor: color, borderColor: color,
backgroundColor: hexToRgbA(color, .3), backgroundColor: hexToRgbA(color, .3),

View File

@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: maps, gpx, gps, graph, chart, leaflet, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence Tags: maps, gpx, gps, graph, chart, leaflet, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Requires at least: 2.0.0 Requires at least: 2.0.0
Tested up to: 4.9.7 Tested up to: 4.9.7
Stable tag: 1.6.01 Stable tag: 1.6.02
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -153,6 +153,8 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == Changelog ==
= 1.6.02 =
* Resolved errors with start and end icons
= 1.6.01 = = 1.6.01 =
* Removed Gogole maps. Leafletjs instead. * Removed Gogole maps. Leafletjs instead.
* -- NextGen Gallery is not working, due next gen image format changed -- I'll fix soon * -- NextGen Gallery is not working, due next gen image format changed -- I'll fix soon

View File

@ -3,7 +3,7 @@
* Plugin Name: WP-GPX-Maps * Plugin Name: WP-GPX-Maps
* Plugin URI: http://www.devfarm.it/ * Plugin URI: http://www.devfarm.it/
* Description: Draws a GPX track with altitude chart * Description: Draws a GPX track with altitude chart
* Version: 1.6.01 * Version: 1.6.02
* Author: Bastianon Massimo * Author: Bastianon Massimo
* Author URI: http://www.devfarm.it/ * Author URI: http://www.devfarm.it/
* Text Domain: wp-gpx-maps * Text Domain: wp-gpx-maps
@ -77,7 +77,7 @@ function enqueue_WP_GPX_Maps_scripts() {
/* chartjs */ /* chartjs */
wp_register_script('chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), "2.7.2" ); wp_register_script('chartjs', plugins_url( '/js/Chart.min.js', __FILE__ ), array(), "2.7.2" );
wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','leaflet','chartjs'), "1.5.05_8" ); wp_register_script('WP-GPX-Maps', plugins_url( '/js/WP-GPX-Maps.js', __FILE__ ), array('jquery','leaflet','chartjs'), "1.6.02" );
/* /*
$wpgpxmaps_googlemapsv3_apikey = get_option('wpgpxmaps_googlemapsv3_apikey'); $wpgpxmaps_googlemapsv3_apikey = get_option('wpgpxmaps_googlemapsv3_apikey');