#zoom/lat/lon hash format is now used consistently.
return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
}
return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
}
-function normalBounds(bounds) {
- if (bounds instanceof L.LatLngBounds) return bounds;
- return new L.LatLngBounds(
- new L.LatLng(bounds[0][0], bounds[0][1]),
- new L.LatLng(bounds[1][0], bounds[1][1]));
-}
-
function remoteEditHandler(bbox, select) {
var loaded = false,
query = {
function remoteEditHandler(bbox, select) {
var loaded = false,
query = {
* Called as the user scrolls/zooms around to maniplate hrefs of the
* view tab and various other links
*/
* Called as the user scrolls/zooms around to maniplate hrefs of the
* view tab and various other links
*/
-function updatelinks(loc, zoom, layers, bounds, object) {
+function updatelinks(loc, zoom, layers, object) {
$(".geolink").each(function(index, link) {
var href = link.href.split(/[?#]/)[0],
args = querystring.parse(link.search.substring(1));
$(".geolink").each(function(index, link) {
var href = link.href.split(/[?#]/)[0],
args = querystring.parse(link.search.substring(1));
- if (bounds && $(link).hasClass("bbox")) args.bbox = normalBounds(bounds).toBBoxString();
if (object && $(link).hasClass("object")) args[object.type] = object.id;
var query = querystring.stringify(args);
if (query) href += '?' + query;
if (object && $(link).hasClass("object")) args[object.type] = object.id;
var query = querystring.stringify(args);
if (query) href += '?' + query;
- if ($(link).hasClass("llz")) {
- args = {
- lat: loc.lat,
- lon: loc.lon || loc.lng,
- zoom: zoom
- };
+ args = {
+ lat: loc.lat,
+ lon: loc.lon || loc.lng,
+ zoom: zoom
+ };
- if (layers && $(link).hasClass("layers")) {
- args.layers = layers;
- }
-
- href += OSM.formatHash(args);
+ if (layers && $(link).hasClass("layers")) {
+ args.layers = layers;
+ href += OSM.formatHash(args);
+
map.getCenter().wrap(),
map.getZoom(),
map.getLayersCode(),
map.getCenter().wrap(),
map.getZoom(),
map.getLayersCode(),
- map.getBounds().wrap(),
map._object);
var expiry = new Date();
map._object);
var expiry = new Date();
notes[feature.properties.id] = updateMarker(marker, feature);
newNote = null;
notes[feature.properties.id] = updateMarker(marker, feature);
newNote = null;
- addNoteButton.removeClass("active").addClass("geolink");
+ addNoteButton.removeClass("active");
if (addNoteButton.hasClass("disabled")) return;
if (addNoteButton.hasClass("active")) return;
if (addNoteButton.hasClass("disabled")) return;
if (addNoteButton.hasClass("active")) return;
- addNoteButton.removeClass("geolink").addClass("active");
+ addNoteButton.addClass("active");
newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
newNote.on("remove", function (e) {
newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
newNote.on("remove", function (e) {
- addNoteButton.removeClass("active").addClass("geolink");
+ addNoteButton.removeClass("active");
}).on("dragstart", function (e) {
$(newNote).stopTime("removenote");
}).on("dragend", function (e) {
}).on("dragstart", function (e) {
$(newNote).stopTime("removenote");
}).on("dragend", function (e) {
- <a href="<% root_path %>" class="geolink llz layers">
+ <a href="<% root_path %>" class="geolink layers">
<%= image_tag "osm_logo.png", :alt => t('layouts.logo.alt_text'), :class => 'logo' %>
<%= t 'layouts.project_name.h1' %>
</a>
<%= image_tag "osm_logo.png", :alt => t('layouts.logo.alt_text'), :class => 'logo' %>
<%= t 'layouts.project_name.h1' %>
</a>
<nav class='primary'>
<ul>
<li id="view_tab" class="<%= current_page_class(root_path) %>">
<nav class='primary'>
<ul>
<li id="view_tab" class="<%= current_page_class(root_path) %>">
- <%= link_to t('layouts.view'), root_path, :class => 'tab geolink llz layers' %>
+ <%= link_to t('layouts.view'), root_path, :class => 'tab geolink layers' %>
</li><li id="edit_tab" class="dropdown <%= current_page_class(edit_path) %>">
</li><li id="edit_tab" class="dropdown <%= current_page_class(edit_path) %>">
- <%= link_to t('layouts.edit'), edit_path, :class => "tab geolink llz object",
+ <%= link_to t('layouts.edit'), edit_path, :class => "tab geolink object",
:id => 'editanchor',
:data => { :editor => preferred_editor }
%><a class='dropdown-toggle' data-toggle='dropdown' href='#'><b class="caret"></b></a>
:id => 'editanchor',
:data => { :editor => preferred_editor }
%><a class='dropdown-toggle' data-toggle='dropdown' href='#'><b class="caret"></b></a>
<%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
edit_path(:editor => editor),
:data => { :editor => editor },
<%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
edit_path(:editor => editor),
:data => { :editor => editor },
- :class => "geolink llz object" %>
+ :class => "geolink object" %>
</li>
<% end %>
</ul>
</li><li id="history_tab" class="<%= current_page_class(browse_changesets_path) %>">
</li>
<% end %>
</ul>
</li><li id="history_tab" class="<%= current_page_class(browse_changesets_path) %>">
- <%= link_to t('layouts.history'), browse_changesets_path, :class => 'tab geolink llz' %>
+ <%= link_to t('layouts.history'), browse_changesets_path, :class => 'tab geolink' %>
</li><li id="export_tab" class="<%= current_page_class(export_path) %>">
</li><li id="export_tab" class="<%= current_page_class(export_path) %>">
- <%= link_to t('layouts.export'), export_path, :class => 'tab geolink llz' %>
+ <%= link_to t('layouts.export'), export_path, :class => 'tab geolink' %>
- var mapMoved = $.throttle(250, function(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
- updatelinks({ lon: lon, lat: lat }, zoom, null, [[minlat, minlon], [maxlat, maxlon]]);
+ var mapMoved = $.throttle(250, function(lon, lat, zoom) {
+ updatelinks({ lon: lon, lat: lat }, zoom);
var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
if (hash !== location.hash) {
var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
if (hash !== location.hash) {
});
id.map().on('move.embed', parent.$.throttle(250, function() {
});
id.map().on('move.embed', parent.$.throttle(250, function() {
- var extent = id.map().extent(),
- zoom = ~~id.map().zoom(),
- center = id.map().center();
+ var zoom = ~~id.map().zoom(),
+ center = id.map().center(),
+ llz = { lon: center[0], lat: center[1], zoom: zoom };
- parent.updatelinks({
- lon: center[0],
- lat: center[1]
- },
- zoom,
- null,
- [[extent[0][1],
- extent[0][0]],
- [extent[1][1],
- extent[1][0]]]);
+ parent.updatelinks(llz, zoom);
// Manually resolve URL to avoid iframe JS context weirdness.
// http://bl.ocks.org/jfirebaugh/5439412
// Manually resolve URL to avoid iframe JS context weirdness.
// http://bl.ocks.org/jfirebaugh/5439412
- var hash = parent.OSM.formatHash({ lon: center[0], lat: center[1], zoom: zoom });
+ var hash = parent.OSM.formatHash(llz);
if (hash !== parent.location.hash) {
parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
}
if (hash !== parent.location.hash) {
parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
}