mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
fixed select_note mode, cleaned note_editor, TODO: enable note save
This commit is contained in:
@@ -71,4 +71,6 @@
|
||||
#new-comment-input {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
max-height: 300px;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@ export function behaviorSelect(context) {
|
||||
.enter(modeSelectNote(context, datum.id));
|
||||
|
||||
} else { // clicked nothing..
|
||||
|
||||
context.selectedNoteID(null);
|
||||
if (!isMultiselect && mode.id !== 'browse') {
|
||||
context.enter(modeBrowse(context));
|
||||
|
||||
@@ -101,7 +101,7 @@ export function modeSelectNote(context, selectedNoteID) {
|
||||
|
||||
context.surface()
|
||||
.selectAll('.note.selected')
|
||||
.classed('selected', false);
|
||||
.classed('selected hovered', false);
|
||||
|
||||
context.map()
|
||||
.on('drawn.select', null);
|
||||
|
||||
@@ -350,7 +350,7 @@ export function rendererMap(context) {
|
||||
surface.selectAll('.layer-osm *').remove();
|
||||
|
||||
var mode = context.mode();
|
||||
if (mode && mode.id !== 'save') {
|
||||
if (mode && mode.id !== 'save' && mode.id !== 'select_note') {
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
|
||||
|
||||
+3
-26
@@ -65,34 +65,11 @@ export function svgNotes(projection, context, dispatch) {
|
||||
|
||||
|
||||
function click(which) {
|
||||
// _selected = which;
|
||||
context.map().centerEase(which.loc);
|
||||
|
||||
// layer.selectAll('.note')
|
||||
// .classed('selected', function(d) { return d === _selected; });
|
||||
|
||||
// context.ui().sidebar.show(noteEditor.note(which));
|
||||
if (context.selectedNoteID() === which.id) {
|
||||
context.map().centerEase(which.loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// function mouseover(which) {
|
||||
// layer.selectAll('.note')
|
||||
// .classed('hovered', function(d) { return d === which; });
|
||||
|
||||
// // context.ui().sidebar.show(noteEditor.note(which));
|
||||
// }
|
||||
|
||||
|
||||
// function mouseout() {
|
||||
// layer.selectAll('.note')
|
||||
// .classed('hovered', false);
|
||||
|
||||
// // TODO: check if the item was clicked. If so, it should remain on the sidebar.
|
||||
// // TODO: handle multi-clicks. Otherwise, utilize behavior/select.js
|
||||
// // context.ui().sidebar.hide();
|
||||
// }
|
||||
|
||||
|
||||
function update() {
|
||||
var service = getService();
|
||||
var selectedID = context.selectedNoteID();
|
||||
|
||||
+23
-21
@@ -18,9 +18,10 @@ var _newComment;
|
||||
|
||||
|
||||
export function uiNoteEditor(context) {
|
||||
var dispatch = d3_dispatch('change', 'cancel', 'save');
|
||||
var dispatch = d3_dispatch('change', 'cancel', 'save', 'changeInput');
|
||||
var formFields = uiFormFields(context);
|
||||
var _fieldsArr;
|
||||
var _modified = false;
|
||||
var _note;
|
||||
|
||||
function localeDateString(s) {
|
||||
@@ -95,6 +96,24 @@ export function uiNoteEditor(context) {
|
||||
}
|
||||
|
||||
|
||||
function newComment(selection) {
|
||||
if (!context.selectedNoteID()) return;
|
||||
// New Comment
|
||||
var saveSection = selection.selectAll('.save-section')
|
||||
.data([0]);
|
||||
|
||||
saveSection = saveSection.enter()
|
||||
.append('div')
|
||||
.attr('class','save-section cf')
|
||||
.merge(saveSection);
|
||||
|
||||
saveSection
|
||||
.call(saveHeader)
|
||||
.call(input)
|
||||
.call(buttons);
|
||||
}
|
||||
|
||||
|
||||
function saveHeader(selection) {
|
||||
var header = selection.selectAll('.notesSaveHeader')
|
||||
.data([0]);
|
||||
@@ -118,7 +137,7 @@ export function uiNoteEditor(context) {
|
||||
.attr('placeholder', t('note.inputPlaceholder'))
|
||||
.attr('maxlength', 1000)
|
||||
.call(utilNoAuto)
|
||||
// .on('input', change(true))
|
||||
.on('input', change(true))
|
||||
.on('blur', change())
|
||||
.on('change', change())
|
||||
.merge(input);
|
||||
@@ -126,9 +145,7 @@ export function uiNoteEditor(context) {
|
||||
|
||||
function change(onInput) {
|
||||
return function() {
|
||||
var t = {};
|
||||
// t[field.key] = utilGetSetValue(input) || undefined;
|
||||
dispatch.call('change', this, t, onInput);
|
||||
dispatch.call('changeInput', this, onInput);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -201,22 +218,6 @@ export function uiNoteEditor(context) {
|
||||
});
|
||||
}
|
||||
|
||||
function newComment(selection) {
|
||||
// New Comment
|
||||
var saveSection = selection.selectAll('.save-section')
|
||||
.data([0]);
|
||||
|
||||
saveSection = saveSection.enter()
|
||||
.append('div')
|
||||
.attr('class','save-section cf')
|
||||
.merge(saveSection);
|
||||
|
||||
saveSection
|
||||
.call(saveHeader)
|
||||
.call(input)
|
||||
.call(buttons);
|
||||
}
|
||||
|
||||
|
||||
function render(selection) {
|
||||
var header = selection.selectAll('.header')
|
||||
@@ -245,6 +246,7 @@ export function uiNoteEditor(context) {
|
||||
.call(noteHeader)
|
||||
.call(noteComments)
|
||||
.call(newComment);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user