mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
updated: hacky note hovering; todo: complete note click handling
This commit is contained in:
@@ -111,14 +111,9 @@ export function behaviorHover(context) {
|
||||
.classed('hover-suppressed', false);
|
||||
|
||||
var entity;
|
||||
if (datum instanceof osmEntity) {
|
||||
if (datum instanceof osmNote || datum instanceof osmEntity) {
|
||||
entity = datum;
|
||||
}
|
||||
// TODO: TAH - reintroduce if we need a check for osmNote here
|
||||
// else if (datum instanceof osmNote) {
|
||||
// entity = datum;
|
||||
// }
|
||||
else {
|
||||
} else {
|
||||
entity = datum && datum.properties && datum.properties.entity;
|
||||
}
|
||||
|
||||
@@ -130,7 +125,7 @@ export function behaviorHover(context) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selector = '.' + entity.id;
|
||||
var selector = (datum instanceof osmNote) ? 'note-' + entity.id : '.' + entity.id;
|
||||
|
||||
if (entity.type === 'relation') {
|
||||
entity.members.forEach(function(member) {
|
||||
@@ -143,7 +138,11 @@ export function behaviorHover(context) {
|
||||
_selection.selectAll(selector)
|
||||
.classed(suppressed ? 'hover-suppressed' : 'hover', true);
|
||||
|
||||
dispatch.call('hover', this, !suppressed && entity.id);
|
||||
if (datum instanceof osmNote) {
|
||||
dispatch.call('hover', this, !suppressed && entity);
|
||||
} else {
|
||||
dispatch.call('hover', this, !suppressed && entity.id);
|
||||
}
|
||||
|
||||
} else {
|
||||
dispatch.call('hover', this, null);
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
modeSelect
|
||||
} from '../modes';
|
||||
|
||||
import { osmEntity } from '../osm';
|
||||
import {
|
||||
osmEntity,
|
||||
osmNote
|
||||
} from '../osm';
|
||||
|
||||
|
||||
export function behaviorSelect(context) {
|
||||
@@ -115,14 +118,19 @@ export function behaviorSelect(context) {
|
||||
var datum = d3_event.target.__data__ || (lastMouse && lastMouse.target.__data__);
|
||||
var mode = context.mode();
|
||||
|
||||
var entity = datum && datum.properties && datum.properties.entity;
|
||||
var entity;
|
||||
|
||||
// check if datum is a note
|
||||
if (datum instanceof osmNote) { entity = datum; }
|
||||
else { entity = datum && datum.properties && datum.properties.entity; }
|
||||
|
||||
if (entity) datum = entity;
|
||||
|
||||
if (datum && datum.type === 'midpoint') {
|
||||
datum = datum.parents[0];
|
||||
}
|
||||
|
||||
if (!(datum instanceof osmEntity)) {
|
||||
if (!(datum instanceof osmEntity) && !(datum instanceof osmNote)) {
|
||||
// clicked nothing..
|
||||
if (!isMultiselect && mode.id !== 'browse') {
|
||||
context.enter(modeBrowse(context));
|
||||
|
||||
Reference in New Issue
Block a user