From 099fd7538590aab608a7c169f8ec02e17fd2012d Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 8 Dec 2016 12:26:37 +0100 Subject: [PATCH] change line style on hover and draw control text --- CHANGELOG.md | 3 ++- js/gpxedit.js | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72c1fd0..a2a463d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,12 +20,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [#6](https://gitlab.com/eneiluj/gpxedit-oc/issues/6) @eneiluj - symbol selects include icons [#6](https://gitlab.com/eneiluj/gpxedit-oc/issues/6) @eneiluj -- gpx route parsing +- gpx route parsing, save it as route ### Changed - detach marker and tooltip styling option - every symbol can be default marker style choices [#6](https://gitlab.com/eneiluj/gpxedit-oc/issues/6) @eneiluj +- line style, control text ### Fixed - remove $.parseXML, apparently useless and producing errors diff --git a/js/gpxedit.js b/js/gpxedit.js index 954664a..27c1bb9 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -135,6 +135,17 @@ var symbolIcons = { }), } +var hoverStyle = { + weight: 12, + opacity: 0.7, + color: 'black' +}; +var defaultStyle = { + opacity: 0.9, + color: '#f357a1', + weight: 7 +}; + function load_map() { var layer = getUrlParameter('layer'); console.log('layer '+layer); @@ -333,6 +344,8 @@ function load_map() { } }; + L.drawLocal.draw.toolbar.buttons.polyline = 'Draw a track'; + L.drawLocal.draw.toolbar.buttons.marker = 'Add a waypoint'; var drawControl = new L.Control.Draw(options); gpxedit.drawControl = drawControl; gpxedit.map.addControl(drawControl); @@ -411,6 +424,14 @@ function onCreated(type, layer){ popupTxt = popupTxt + ''; layer.bindPopup(popupTxt); + if (type !== 'marker') { + layer.on('mouseover', function(){ + layer.setStyle(hoverStyle); + }); + layer.on('mouseout', function(){ + layer.setStyle(defaultStyle); + }); + } layer.gpxedit_id = gpxedit.id; layer.type = layerType;