Remove old layout Control superclass, now obsolete (#111)

This commit is contained in:
Norbert Renner 2018-07-12 20:28:22 +02:00
parent 4d4b344793
commit 9112d0984c
4 changed files with 6 additions and 56 deletions

View file

@ -1,39 +0,0 @@
BR.Control = L.Control.extend({
options: {
position: 'bottomleft'
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'info'),
heading,
div;
if (this.options.heading) {
heading = L.DomUtil.create('div', 'heading', container);
heading.innerHTML = this.options.heading;
this._content = L.DomUtil.create('div', 'content', container);
} else {
this._content = container;
}
if (this.options.divId) {
div = L.DomUtil.get(this.options.divId);
L.DomUtil.removeClass(div, 'hidden');
this._content.appendChild(div);
}
var stop = L.DomEvent.stopPropagation;
L.DomEvent
.on(container, 'click', stop)
.on(container, 'mousedown', stop)
.on(container, 'dblclick', stop)
.on(container, 'mousewheel', stop)
.on(container, 'MozMousePixelScroll', stop);
// disabled because links not working, remove?
//L.DomEvent.on(container, 'click', L.DomEvent.preventDefault);
return container;
}
});

View file

@ -1,6 +1,6 @@
BR.RoutingOptions = BR.Control.extend({
BR.RoutingOptions = L.Evented.extend({
onAdd: function (map) {
initialize: function () {
$('#profile-alternative').on('changed.bs.select', this._getChangeHandler());
// build option list from config
@ -16,7 +16,6 @@ BR.RoutingOptions = BR.Control.extend({
profiles_list.children[0].value = "Custom";
// <custom> profile is empty at start, select next one
profiles_list.children[1].selected = true;
return BR.Control.prototype.onAdd.call(this, map);
},
refreshUI: function() {
@ -106,5 +105,3 @@ BR.RoutingOptions = BR.Control.extend({
}, this);
}
});
BR.RoutingOptions.include(L.Evented.prototype);

View file

@ -1,7 +1,6 @@
BR.TrackMessages = L.Evented.extend({
BR.TrackMessages = L.Class.extend({
options: {
heading: 'Segment data',
edgeStyle: {
color: 'yellow',
opacity: 0.8,
@ -24,18 +23,15 @@ BR.TrackMessages = L.Evented.extend({
'InitialCost': { title: 'initial$', className: 'dt-body-right' }
},
initialize: function (options) {
initialize: function (map, options) {
L.setOptions(this, options);
this._map = map;
var table = document.getElementById('datatable');
this.tableClassName = table.className;
this.tableParent = table.parentElement;
},
onAdd: function (map) {
this._map = map;
},
update: function (polyline, segments) {
var i, messages, columns, headings,
data = [];

View file

@ -166,7 +166,7 @@
profile.message.hide();
routingOptions.setCustomProfile(null);
});
trackMessages = new BR.TrackMessages({
trackMessages = new BR.TrackMessages(map, {
requestUpdate: requestUpdate
});
@ -222,13 +222,9 @@
download.update(urls);
};
routingOptions.addTo(map);
routing.addTo(map);
elevation.addBelow(map);
trackMessages.onAdd(map);
sidebar = BR.sidebar({
defaultTabId: BR.conf.transit ? 'tab_itinerary' : 'tab_profile',
listeningTabs: {