mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Show all features as auto-hidden when map is not editable
This commit is contained in:
@@ -185,7 +185,7 @@ window.iD = function () {
|
||||
};
|
||||
|
||||
context.editable = function() {
|
||||
return map.editable() && mode && mode.id !== 'save';
|
||||
return map.editable();
|
||||
};
|
||||
|
||||
/* Behaviors */
|
||||
@@ -205,7 +205,7 @@ window.iD = function () {
|
||||
context.background = function() { return background; };
|
||||
|
||||
/* Features */
|
||||
var features = iD.Features();
|
||||
var features = iD.Features(context);
|
||||
context.features = function() { return features; };
|
||||
context.hasHiddenConnections = function(id) {
|
||||
var graph = history.graph(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
iD.Features = function() {
|
||||
iD.Features = function(context) {
|
||||
var major_roads = {
|
||||
'motorway': true,
|
||||
'motorway_link': true,
|
||||
@@ -65,7 +65,7 @@ iD.Features = function() {
|
||||
defaultMax: (max || Infinity),
|
||||
enable: function() { this.enabled = true; this.currentMax = this.defaultMax; },
|
||||
disable: function() { this.enabled = false; this.currentMax = 0; },
|
||||
hidden: function() { return this.count > this.currentMax * _cullFactor; },
|
||||
hidden: function() { return !context.editable() || this.count > this.currentMax * _cullFactor; },
|
||||
autoHidden: function() { return this.hidden() && this.currentMax > 0; }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ iD.ui.Modes = function(context) {
|
||||
iD.modes.AddLine(context),
|
||||
iD.modes.AddArea(context)];
|
||||
|
||||
function editable() {
|
||||
return context.editable() && context.mode().id !== 'save'
|
||||
}
|
||||
|
||||
return function(selection) {
|
||||
var buttons = selection.selectAll('button.add-button')
|
||||
.data(modes);
|
||||
@@ -31,8 +35,6 @@ iD.ui.Modes = function(context) {
|
||||
context
|
||||
.on('enter.modes', update);
|
||||
|
||||
update();
|
||||
|
||||
buttons.append('span')
|
||||
.attr('class', function(mode) { return mode.id + ' icon icon-pre-text'; });
|
||||
|
||||
@@ -54,14 +56,14 @@ iD.ui.Modes = function(context) {
|
||||
var keybinding = d3.keybinding('mode-buttons');
|
||||
|
||||
modes.forEach(function(m) {
|
||||
keybinding.on(m.key, function() { if (context.editable()) context.enter(m); });
|
||||
keybinding.on(m.key, function() { if (editable()) context.enter(m); });
|
||||
});
|
||||
|
||||
d3.select(document)
|
||||
.call(keybinding);
|
||||
|
||||
function update() {
|
||||
buttons.property('disabled', !context.editable());
|
||||
buttons.property('disabled', !editable());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ iD.ui.Notice = function(context) {
|
||||
.text(t('zoom_in_edit'));
|
||||
|
||||
function disableTooHigh() {
|
||||
div.style('display', context.map().editable() ? 'none' : 'block');
|
||||
div.style('display', context.editable() ? 'none' : 'block');
|
||||
}
|
||||
|
||||
context.map()
|
||||
|
||||
Reference in New Issue
Block a user