Disable Add Note '4' shortcut when notes layer is not enabled

(also return to browse mode if notes or osm layers get disabled)
(closes #5190)
This commit is contained in:
Bryan Housel
2018-08-06 14:45:10 -04:00
parent 0be1705a0d
commit 12f402c48b
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -8,6 +8,7 @@ import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import { svgIcon } from '../svg';
import { t, textDirection } from '../util/locale';
import { tooltip } from '../util/tooltip';
import { modeBrowse } from '../modes';
import { uiBackground } from './background';
import { uiDisclosure } from './disclosure';
import { uiHelp } from './help';
@@ -75,6 +76,11 @@ export function uiMapData(context) {
var layer = layers.layer(which);
if (layer) {
layer.enabled(enabled);
if (!enabled && (which === 'osm' || which === 'notes')) {
context.enter(modeBrowse(context));
}
update();
}
}
+1 -1
View File
@@ -60,7 +60,7 @@ export function uiModes(context) {
modes.forEach(function(mode) {
keybinding.on(mode.key, function() {
if (mode.id === 'add-note' && !notesEditable()) return;
if (mode.id === 'add-note' && !(notesEnabled() && notesEditable())) return;
if (mode.id !== 'add-note' && !editable()) return;
if (mode.id === context.mode().id) {