Skip to content

Commit aa6f26b

Browse files
committed
Convert leaflet markers to SVG
1 parent 9983a16 commit aa6f26b

16 files changed

+120
-56
lines changed

app/assets/config/manifest.js

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@
1717

1818
//= link_tree ../../../vendor/assets/leaflet .png
1919

20-
//= link leaflet/dist/images/marker-icon.png
21-
//= link leaflet/dist/images/marker-icon-2x.png
2220
//= link leaflet/dist/images/marker-shadow.png
2321
//= link cal-heatmap/dist/cal-heatmap.css
+14-13
Loading

app/assets/images/marker-blue.png

-1.48 KB
Binary file not shown.

app/assets/images/marker-blue.svg

+20
Loading

app/assets/images/marker-green.png

-1.43 KB
Binary file not shown.

app/assets/images/marker-green.svg

+20
Loading

app/assets/images/marker-red.png

-1.43 KB
Binary file not shown.

app/assets/images/marker-red.svg

+20
Loading

app/assets/images/new_note_marker.svg

+18-13
Loading
+14-13
Loading

app/assets/javascripts/embed.js.erb

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ window.onload = function () {
5959

6060
if (args.marker) {
6161
L.marker(args.marker.split(","), { icon: L.icon({
62-
iconUrl: <%= asset_path('leaflet/dist/images/marker-icon.png').to_json %>,
63-
iconSize: new L.Point(25, 41),
64-
iconAnchor: new L.Point(12, 41),
65-
shadowUrl: <%= asset_path('leaflet/dist/images/marker-shadow.png').to_json %>,
66-
shadowSize: new L.Point(41, 41)
62+
iconUrl: <%= image_path("marker-blue.svg").to_json %>,
63+
iconSize: [25, 41],
64+
iconAnchor: [12, 41],
65+
shadowUrl: <%= image_path("leaflet/dist/images/marker-shadow.png").to_json %>,
66+
shadowSize: [41, 41]
6767
}) }).addTo(map);
6868
}
6969

app/assets/javascripts/leaflet.map.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ L.OSM.Map = L.Map.extend({
373373
L.Icon.Default.imagePath = "/images/";
374374

375375
L.Icon.Default.imageUrls = {
376-
"/images/marker-icon.png": OSM.MARKER_ICON,
377-
"/images/marker-icon-2x.png": OSM.MARKER_ICON_2X,
376+
"/images/marker-icon.png": OSM.MARKER_BLUE,
377+
"/images/marker-icon-2x.png": OSM.MARKER_BLUE,
378378
"/images/marker-shadow.png": OSM.MARKER_SHADOW
379379
};
380380

app/assets/javascripts/osm.js.erb

+3-4
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ OSM = {
3232
LAYER_DEFINITIONS: <%= YAML.load_file(Rails.root.join("config/layers.yml")).to_json %>,
3333
LAYERS_WITH_MAP_KEY: <%= YAML.load_file(Rails.root.join("config/key.yml")).keys.to_json %>,
3434

35-
MARKER_GREEN: <%= image_path("marker-green.png").to_json %>,
36-
MARKER_RED: <%= image_path("marker-red.png").to_json %>,
35+
MARKER_RED: <%= image_path("marker-red.svg").to_json %>,
36+
MARKER_GREEN: <%= image_path("marker-green.svg").to_json %>,
37+
MARKER_BLUE: <%= image_path("marker-blue.svg").to_json %>,
3738

38-
MARKER_ICON: <%= image_path("leaflet/dist/images/marker-icon.png").to_json %>,
39-
MARKER_ICON_2X: <%= image_path("leaflet/dist/images/marker-icon-2x.png").to_json %>,
4039
MARKER_SHADOW: <%= image_path("leaflet/dist/images/marker-shadow.png").to_json %>,
4140

4241
NEW_NOTE_MARKER: <%= image_path("new_note_marker.svg").to_json %>,

app/views/dashboards/_contact.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<% user_data = {
22
:lon => contact.home_lon,
33
:lat => contact.home_lat,
4-
:icon => image_path(type == "following" ? "marker-blue.png" : "marker-green.png"),
4+
:icon => image_path(type == "following" ? "marker-blue.svg" : "marker-green.svg"),
55
:description => render(:partial => "popup", :object => contact, :locals => { :type => type })
66
} %>
77
<%= tag.div :class => "clearfix row", :data => { :user => user_data } do %>

app/views/dashboards/show.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<% user_data = {
1616
:lon => current_user.home_lon,
1717
:lat => current_user.home_lat,
18-
:icon => image_path("marker-red.png"),
18+
:icon => image_path("marker-red.svg"),
1919
:description => render(:partial => "popup", :object => current_user, :locals => { :type => "your location" })
2020
} %>
2121
<%= tag.div "", :id => "map", :class => "content_map border border-secondary-subtle rounded z-0", :data => { :user => user_data } %>

app/views/layouts/_search.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
<div class="d-flex flex-column gap-1 flex-grow-1">
4141
<div class="d-flex gap-2 align-items-center">
4242
<div class="routing_marker_column position-absolute">
43-
<%= image_tag "marker-green.png", :class => "img-fluid", :data => { :type => "from" }, :draggable => "true" %>
43+
<%= image_tag "marker-green.svg", :class => "img-fluid", :data => { :type => "from" }, :draggable => "true" %>
4444
</div>
4545
<%= text_field_tag "route_from", params[:from], :placeholder => t("site.search.from"), :autocomplete => "on", :class => "form-control py-1 px-2 ps-4", :dir => "auto" %>
4646
</div>
4747
<div class="d-flex gap-2 align-items-center">
4848
<div class="routing_marker_column position-absolute">
49-
<%= image_tag "marker-red.png", :class => "img-fluid", :data => { :type => "to" }, :draggable => "true" %>
49+
<%= image_tag "marker-red.svg", :class => "img-fluid", :data => { :type => "to" }, :draggable => "true" %>
5050
</div>
5151
<%= text_field_tag "route_to", params[:to], :placeholder => t("site.search.to"), :autocomplete => "on", :class => "form-control py-1 px-2 ps-4", :dir => "auto" %>
5252
</div>

0 commit comments

Comments
 (0)