mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 23:14:47 +02:00
Show rudimentary name in the tooltip dialog
This commit is contained in:
+26
-4
@@ -17,6 +17,7 @@ declare("iD.Entity", null, {
|
||||
parents: null,
|
||||
modified: false,
|
||||
deleted: false,
|
||||
MAINKEYS: ['highway','amenity','railway','waterway'],
|
||||
|
||||
constructor:function() {
|
||||
this.tags={};
|
||||
@@ -27,10 +28,6 @@ declare("iD.Entity", null, {
|
||||
return this.entityType==_type;
|
||||
},
|
||||
|
||||
getTagsHash:function() {
|
||||
return this.tags;
|
||||
},
|
||||
|
||||
toString:function() {
|
||||
return this.entityType+"."+this.id;
|
||||
},
|
||||
@@ -53,6 +50,31 @@ declare("iD.Entity", null, {
|
||||
|
||||
within:function(left,right,top,bottom) { return !this.deleted; },
|
||||
|
||||
// Tag functions
|
||||
|
||||
getTagsHash:function() {
|
||||
return this.tags;
|
||||
},
|
||||
|
||||
numTags:function() {
|
||||
var c=0;
|
||||
for (var i in this.tags) { c++; }
|
||||
return c;
|
||||
},
|
||||
|
||||
friendlyName:function() {
|
||||
if (this.numTags()==0) { return ''; }
|
||||
var n=[];
|
||||
if (this.tags['name']) { n.push(this.tags['name']); }
|
||||
if (this.tags['ref']) { n.push(this.tags['ref']); }
|
||||
if (n.length==0) {
|
||||
for (var i=0; i<this.MAINKEYS.length; i++) {
|
||||
if (this.tags[this.MAINKEYS[i]]) { n.push(this.tags[this.MAINKEYS[i]]); break; }
|
||||
}
|
||||
}
|
||||
return n.length==0 ? 'unknown' : n.join('; ');
|
||||
},
|
||||
|
||||
// Parent-handling
|
||||
|
||||
addParent:function(_entity) {
|
||||
|
||||
@@ -13,18 +13,18 @@ declare("iD.controller.edit.EditBaseState", [iD.controller.ControllerState], {
|
||||
constructor:function() {
|
||||
},
|
||||
|
||||
openEditorTooltip:function(x,y) {
|
||||
editortooltip = new dijit.TooltipDialog({
|
||||
content: "Fred's House<br/>"+
|
||||
"<button data-dojo-type='dijit.form.Button' type='submit'>Edit tags</button> "+
|
||||
"<button data-dojo-type='dijit.form.Button' type='submit'>Edit shape</button> ",
|
||||
openEditorTooltip:function(x,y,entity) {
|
||||
var h=entity.friendlyName(); h = (h=='') ? h : h+"<br/>";
|
||||
this.editortooltip = new dijit.TooltipDialog({
|
||||
content: h+"<button data-dojo-type='dijit.form.Button' type='submit'>Edit tags</button> "
|
||||
+"<button data-dojo-type='dijit.form.Button' type='submit'>Edit shape</button> ",
|
||||
autoFocus: false
|
||||
});
|
||||
dijit.popup.open({ popup: editortooltip, x: x, y: y });
|
||||
dijit.popup.open({ popup: this.editortooltip, x: x, y: y });
|
||||
},
|
||||
|
||||
closeEditorTooltip:function() {
|
||||
if (this.editortooltip) { dijit.popup.close(editortooltip); }
|
||||
if (this.editortooltip) { dijit.popup.close(this.editortooltip); }
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ declare("iD.controller.edit.SelectedPOINode", [iD.controller.edit.EditBaseState]
|
||||
this.nodeUI.setStateClass('selected');
|
||||
this.nodeUI.redraw();
|
||||
this.openEditorTooltip(map.lon2screen(this.node.lon),
|
||||
map.lat2screen(this.node.lat));
|
||||
map.lat2screen(this.node.lat), this.node);
|
||||
},
|
||||
exitState:function() {
|
||||
this.nodeUI.resetStateClass('selected');
|
||||
|
||||
@@ -19,7 +19,7 @@ declare("iD.controller.edit.SelectedWay", [iD.controller.edit.EditBaseState], {
|
||||
this.wayUI=this.controller.map.getUI(this.way);
|
||||
this.wayUI.setStateClass('selected');
|
||||
this.wayUI.setStateClass('shownodes');
|
||||
if (this.entryevent) { this.openEditorTooltip(this.entryevent.clientX, this.entryevent.clientY); }
|
||||
if (this.entryevent) { this.openEditorTooltip(this.entryevent.clientX, this.entryevent.clientY, this.way); }
|
||||
this.wayUI.redraw();
|
||||
},
|
||||
exitState:function() {
|
||||
|
||||
@@ -19,7 +19,7 @@ declare("iD.controller.edit.SelectedWayNode", [iD.controller.edit.EditBaseState]
|
||||
map.getUI(this.way ).setStateClass('shownodes').redraw();
|
||||
map.getUI(this.node).setStateClass('selected' ).redraw();
|
||||
this.openEditorTooltip(map.lon2screen(this.node.lon),
|
||||
map.lat2screen(this.node.lat));
|
||||
map.lat2screen(this.node.lat), this.node);
|
||||
},
|
||||
exitState:function() {
|
||||
var map=this.controller.map;
|
||||
|
||||
Reference in New Issue
Block a user