WIP drag note

This commit is contained in:
Thomas Hervey
2018-07-20 21:41:44 -04:00
parent 2cde7843f2
commit bf9b19359a
14 changed files with 315 additions and 20 deletions
+2 -2
View File
@@ -16,6 +16,7 @@ import {
import { svgIcon } from '../svg';
import { tooltip } from '../util/tooltip';
import { uiTooltipHtml } from './tooltipHtml';
import { services } from '../services/index.js';
export function uiModes(context) {
@@ -36,7 +37,7 @@ export function uiModes(context) {
function toggleNewNote() {
return svgNotes().enabled()
&& context.connection().authenticated()
&& ~~context.map().zoom() >= 12;
&& ~~context.map().zoom() >= 16;
}
@@ -97,7 +98,6 @@ export function uiModes(context) {
modes.forEach(function(mode) {
keybinding.on(mode.key, function() {
// TODO: allow zooming out beyond minZoom when adding new note. Currently prevented
if ((editable() && mode.id !== 'add-note') || (toggleNewNote() && mode.id === 'add-note')) {
if (mode.id === context.mode().id) {
context.enter(modeBrowse(context));
+5 -1
View File
@@ -40,7 +40,11 @@ export function uiNoteEditor(context) {
headerEnter
.append('button')
.attr('class', 'fr note-editor-close')
.on('click', function() { context.enter(modeBrowse(context)); })
.on('click', function() {
var osm = services.osm;
if (_note.isNew()) { osm.removeNote(_note); } // delete new note
context.enter(modeBrowse(context));
})
.call(svgIcon('#iD-icon-close'));
headerEnter