From f8f1c1f5412e85a0aab71b5e664beb3a89a22f98 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 9 Aug 2018 23:25:06 -0400 Subject: [PATCH] Ensure both notes and nodes can be dragged in selectNote mode --- css/65_data.css | 3 ++- modules/modes/drag_note.js | 10 +++++----- modules/modes/select_note.js | 6 +++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/css/65_data.css b/css/65_data.css index 7fca3c9e8..38346e8a2 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -7,7 +7,8 @@ pointer-events: none; } .mode-browse .layer-notes .note .note-fill, -.mode-select .layer-notes .note .note-fill { +.mode-select .layer-notes .note .note-fill, +.mode-select-note .layer-notes .note .note-fill { pointer-events: visible; cursor: pointer; /* Opera */ cursor: url(img/cursor-select-point.png), pointer; /* FF */ diff --git a/modules/modes/drag_note.js b/modules/modes/drag_note.js index 7b1ca0106..7f834cb10 100644 --- a/modules/modes/drag_note.js +++ b/modules/modes/drag_note.js @@ -4,6 +4,7 @@ import { } from 'd3-selection'; import { services } from '../services'; +import { actionNoop } from '../actions'; import { behaviorEdit, behaviorDrag } from '../behavior'; import { geoVecSubtract, geoViewportEdge } from '../geo'; import { modeSelectNote } from './index'; @@ -47,7 +48,9 @@ export function modeDragNote(context) { context.surface().selectAll('.note-' + note.id) .classed('active', true); + context.perform(actionNoop()); context.enter(mode); + context.selectedNoteID(note.id); } @@ -79,15 +82,12 @@ export function modeDragNote(context) { osm.replaceNote(note); // update note cache } - // update note on screen (no need to do a full redraw) - context.surface().selectAll('.note-' + note.id) - .attr('transform', 'translate(' + currMouse[0] + ',' + currMouse[1] + ')'); + context.replace(actionNoop()); // trigger redraw } function end(note) { - // force a reraw (there is no history change that would otherwise do this) - context.pan([0,0]); + context.replace(actionNoop()); // trigger redraw context .selectedNoteID(note.id) diff --git a/modules/modes/select_note.js b/modules/modes/select_note.js index c4f6b0bb2..c2eb8aba0 100644 --- a/modules/modes/select_note.js +++ b/modules/modes/select_note.js @@ -12,7 +12,10 @@ import { behaviorSelect } from '../behavior'; -import { modeDragNote } from '../modes'; +import { + modeDragNode, + modeDragNote +} from '../modes'; import { services } from '../services'; import { modeBrowse } from './browse'; @@ -41,6 +44,7 @@ export function modeSelectNote(context, selectedNoteID) { behaviorHover(context), behaviorSelect(context), behaviorLasso(context), + modeDragNode(context).behavior, modeDragNote(context).behavior ];