Skip to content

Commit 04029c8

Browse files
committed
Convert leaflet markers to SVG
1 parent 6948eda commit 04029c8

14 files changed

+107
-44
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
+9-8
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

+17-12
Loading
+9-8
Loading

app/assets/javascripts/embed.js.erb

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

4040
if (args.has("marker")) {
4141
L.marker(args.get("marker").split(","), { icon: L.icon({
42-
iconUrl: <%= asset_path('leaflet/dist/images/marker-icon.png').to_json %>,
43-
iconSize: new L.Point(25, 41),
44-
iconAnchor: new L.Point(12, 41),
45-
shadowUrl: <%= asset_path('leaflet/dist/images/marker-shadow.png').to_json %>,
46-
shadowSize: new L.Point(41, 41)
42+
iconUrl: <%= image_path("marker-blue.svg").to_json %>,
43+
iconSize: [25, 41],
44+
iconAnchor: [12, 41],
45+
shadowUrl: <%= image_path("leaflet/dist/images/marker-shadow.png").to_json %>,
46+
shadowSize: [41, 41]
4747
}) }).addTo(map);
4848
}
4949

app/assets/javascripts/leaflet.map.js

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

371371
L.Icon.Default.imageUrls = {
372-
"/images/marker-icon.png": OSM.MARKER_ICON,
373-
"/images/marker-icon-2x.png": OSM.MARKER_ICON_2X,
372+
"/images/marker-icon.png": OSM.MARKER_BLUE,
373+
"/images/marker-icon-2x.png": OSM.MARKER_BLUE,
374374
"/images/marker-shadow.png": OSM.MARKER_SHADOW
375375
};
376376

app/assets/javascripts/osm.js.erb

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ OSM = {
3030
LAYER_DEFINITIONS: <%= MapLayers::full_definitions("config/layers.yml").to_json %>,
3131
LAYERS_WITH_MAP_KEY: <%= YAML.load_file(Rails.root.join("config/key.yml")).keys.to_json %>,
3232

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

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

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

app/views/layouts/_search.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
<div class="d-flex flex-column gap-1 flex-grow-1">
4343
<div class="d-flex gap-2 align-items-center">
4444
<div class="routing_marker_column position-absolute">
45-
<%= image_tag "marker-green.png", :class => "img-fluid", :data => { :type => "from" }, :draggable => "true" %>
45+
<%= image_tag "marker-green.svg", :class => "img-fluid", :data => { :type => "from" }, :draggable => "true" %>
4646
</div>
4747
<%= 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" %>
4848
</div>
4949
<div class="d-flex gap-2 align-items-center">
5050
<div class="routing_marker_column position-absolute">
51-
<%= image_tag "marker-red.png", :class => "img-fluid", :data => { :type => "to" }, :draggable => "true" %>
51+
<%= image_tag "marker-red.svg", :class => "img-fluid", :data => { :type => "to" }, :draggable => "true" %>
5252
</div>
5353
<%= 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" %>
5454
</div>

0 commit comments

Comments
 (0)