Separate the add note button from the add feature buttons

This commit is contained in:
Quincy Morgan
2019-02-28 15:48:47 -05:00
parent a2297c8896
commit 4e5b507fc5
3 changed files with 137 additions and 21 deletions
+4 -21
View File
@@ -6,7 +6,6 @@ import {
modeAddArea,
modeAddLine,
modeAddPoint,
modeAddNote,
modeBrowse
} from '../modes';
@@ -20,17 +19,12 @@ export function uiModes(context) {
var modes = [
modeAddPoint(context),
modeAddLine(context),
modeAddArea(context),
modeAddNote(context)
modeAddArea(context)
];
function enabled(d) {
if (d.id === 'add-note') {
return notesEnabled() && notesEditable();
} else {
return osmEditable();
}
function enabled() {
return osmEditable();
}
function osmEditable() {
@@ -38,16 +32,6 @@ export function uiModes(context) {
return context.editable() && mode && mode.id !== 'save';
}
function notesEnabled() {
var noteLayer = context.layers().layer('notes');
return noteLayer && noteLayer.enabled();
}
function notesEditable() {
var mode = context.mode();
return context.map().notesEditable() && mode && mode.id !== 'save';
}
return function(selection) {
context
@@ -91,8 +75,7 @@ export function uiModes(context) {
function update() {
var showNotes = notesEnabled();
var data = showNotes ? modes : modes.slice(0, 3);
var data = modes;
// add favorite presets to modes
var favoritePresets = context.getFavoritePresets();