From 6dcb879990e918b74769ebcd4f2e4a564cef5211 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 23 Jul 2018 23:39:10 -0400 Subject: [PATCH] Remove notes and deselect any selected note when disabling notes layer --- modules/svg/notes.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/svg/notes.js b/modules/svg/notes.js index 3adcced5a..f4f5048ec 100644 --- a/modules/svg/notes.js +++ b/modules/svg/notes.js @@ -3,6 +3,7 @@ import _throttle from 'lodash-es/throttle'; import { select as d3_select } from 'd3-selection'; import { dispatch as d3_dispatch } from 'd3-dispatch'; +import { modeBrowse } from '../modes'; import { svgPointTransform } from './index'; import { services } from '../services'; @@ -51,7 +52,7 @@ export function svgNotes(projection, context, dispatch) { function showLayer() { - // editOn(); + editOn(); layer .classed('disabled', false) @@ -66,7 +67,7 @@ export function svgNotes(projection, context, dispatch) { function hideLayer() { - // editOff(); + editOff(); throttledRedraw.cancel(); layer.interrupt(); @@ -179,14 +180,19 @@ export function svgNotes(projection, context, dispatch) { } } - drawNotes.enabled = function(_) { + drawNotes.enabled = function(val) { if (!arguments.length) return svgNotes.enabled; - svgNotes.enabled = _; + + svgNotes.enabled = val; if (svgNotes.enabled) { showLayer(); } else { hideLayer(); + if (context.selectedNoteID()) { + context.enter(modeBrowse(context)); + } } + dispatch.call('change'); return this; };