Skip to content

Commit de43fe5

Browse files
committed
Overhaul markers
1 parent bb7a8d7 commit de43fe5

20 files changed

+171
-64
lines changed

app/assets/config/manifest.js

-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@
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

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-from.svg

+20
Loading

app/assets/images/marker-green.png

-1.43 KB
Binary file not shown.

app/assets/images/marker-green.svg

+20
Loading
+14-13
Loading

app/assets/images/marker-note-new.svg

+18-13
Loading
+14-13
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/marker-to.svg

+20
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, 40],
64+
iconAnchor: [12, 40],
65+
shadowUrl: <%= image_path("leaflet/dist/images/marker-shadow.png").to_json %>,
66+
shadowSize: [41, 41]
6767
}) }).addTo(map);
6868
}
6969

app/assets/javascripts/index/directions-endpoint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch
44
endpoint.marker = L.marker([0, 0], {
55
icon: L.icon({
66
iconUrl: iconUrl,
7-
iconSize: [25, 41],
8-
iconAnchor: [12, 41],
7+
iconSize: [25, 40],
8+
iconAnchor: [12, 40],
99
popupAnchor: [1, -34],
1010
shadowUrl: OSM.MARKER_SHADOW,
1111
shadowSize: [41, 41]

app/assets/javascripts/index/directions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ OSM.Directions = function (map) {
3333
};
3434

3535
const endpoints = [
36-
OSM.DirectionsEndpoint(map, $("input[name='route_from']"), OSM.MARKER_GREEN, endpointDragCallback, endpointChangeCallback),
37-
OSM.DirectionsEndpoint(map, $("input[name='route_to']"), OSM.MARKER_RED, endpointDragCallback, endpointChangeCallback)
36+
OSM.DirectionsEndpoint(map, $("input[name='route_from']"), OSM.MARKER_FROM, endpointDragCallback, endpointChangeCallback),
37+
OSM.DirectionsEndpoint(map, $("input[name='route_to']"), OSM.MARKER_TO, endpointDragCallback, endpointChangeCallback)
3838
];
3939

4040
let downloadURL = null;

app/assets/javascripts/leaflet.map.js

+4-4
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

@@ -398,8 +398,8 @@ OSM.isDarkMap = function () {
398398
OSM.getUserIcon = function (url) {
399399
return L.icon({
400400
iconUrl: url || OSM.MARKER_RED,
401-
iconSize: [25, 41],
402-
iconAnchor: [12, 41],
401+
iconSize: [25, 40],
402+
iconAnchor: [12, 40],
403403
popupAnchor: [1, -34],
404404
shadowUrl: OSM.MARKER_SHADOW,
405405
shadowSize: [41, 41]

app/assets/javascripts/osm.js.erb

+8-6
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ 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 %>,
37-
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 %>,
40-
MARKER_SHADOW: <%= image_path("leaflet/dist/images/marker-shadow.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 %>,
4138

4239
MARKER_NOTE_NEW: <%= image_path("marker-note-new.svg").to_json %>,
4340
MARKER_NOTE_OPEN: <%= image_path("marker-note-open.svg").to_json %>,
4441
MARKER_NOTE_CLOSED: <%= image_path("marker-note-closed.svg").to_json %>,
4542

43+
MARKER_FROM: <%= image_path("marker-from.svg").to_json %>,
44+
MARKER_TO: <%= image_path("marker-to.svg").to_json %>,
45+
46+
MARKER_SHADOW: <%= image_path("leaflet/dist/images/marker-shadow.png").to_json %>,
47+
4648
apiUrl: function (object) {
4749
const apiType = object.type === "note" ? "notes" : object.type;
4850
let url = "/api/" + OSM.API_VERSION + "/" + apiType + "/" + object.id;

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 } %>

0 commit comments

Comments
 (0)