Get infoboxes to toggle and position correctly, repeatedly

This commit is contained in:
Tom MacWright
2012-10-18 14:45:00 -04:00
parent b5d1c9c26a
commit 9b61648611
4 changed files with 33 additions and 38 deletions
+10
View File
@@ -162,3 +162,13 @@ polyline {
color:#222;
background:#fff;
}
.edit-pane a.close {
position:absolute;
top:0;
right:10px;
font-weight:bold;
text-decoration:none;
font-size:18px;
color:#DD4848;
}
+1
View File
@@ -151,6 +151,7 @@ require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented
<!-- Floating edit pane -->
<div class='edit-pane'>
<h2>&nbsp;</h2>
<a class='close' href='#close'>&times;</a>
<div class='tabs'>
<a class='active' href='#presets'>Presets</a>
<a href='#tags'>Tags</a>
+21 -37
View File
@@ -10,51 +10,35 @@ define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/on',
declare("iD.controller.edit.EditBaseState", [iD.controller.ControllerState], {
editortooltip: null,
constructor: function() {
// summary: Base state for the 'Edit object' states - where an
// object is selected and the user is making changes to it.
},
openEditorTooltip: function(x, y, entity) {
// summary: Open the initial 'Edit tags/Edit shape' tooltip.
// x: Number Screen co-ordinate.
// y: Number Screen co-ordinate.
constructor: function() {
// summary: Base state for the 'Edit object' states - where an
// object is selected and the user is making changes to it.
},
openEditorTooltip: function(x, y, entity) {
// summary: Open the initial 'Edit tags/Edit shape' tooltip.
// x: Number Screen co-ordinate.
// y: Number Screen co-ordinate.
// entity: iD.Entity The entity to be edited.
$('.edit-pane h2').text(iD.Util.friendlyName(entity));
$('.edit-pane').offset({
$('.edit-pane').css({
left: x,
top: y
}).show();
/*
this.editortooltip = new dijit.TooltipDialog({
content: h + "<button data-dojo-type='dijit.form.Button' id='editTags' parseOnLoad='false' type='submit'>Edit tags</button> " +
"<button data-dojo-type='dijit.form.Button' id='editShape' parseOnLoad='false' type='submit'>Edit shape</button> ",
autoFocus: false
});
on(registry.byId('editTags'), 'click', lang.hitch(this,this.editTags,entity));
dijit.popup.open({ popup: this.editortooltip, x: x, y: y });
*/
},
closeEditorTooltip: function() {
// summary: Close the tooltip.
array.forEach(['editTags','editShape'], function(b){
if (!registry.byId(b)) return;
registry.byId(b).type = ''; // fix Safari issue
registry.byId(b).destroy(); // remove from registry so we can reinitialise next time
});
if (this.editortooltip) {
dijit.popup.close(this.editortooltip);
}
},
$('.edit-pane a[href=#close]').click(this.closeEditorTooltip);
},
editTags:function(entity) {
// summary: Open a tag editor for the selected entity.
var tagEditor = new iD.tags.TagEditor(entity,this.controller);
this.closeEditorTooltip();
}
closeEditorTooltip: function() {
// summary: Close the tooltip.
$('.edit-pane').hide();
},
editTags:function(entity) {
// summary: Open a tag editor for the selected entity.
var tagEditor = new iD.tags.TagEditor(entity, this.controller);
this.closeEditorTooltip();
}
});
// ----------------------------------------------------------------------
+1 -1
View File
@@ -28,7 +28,7 @@ define(['dojo/_base/declare','iD/controller/edit/EditBaseState'], function(decla
exitState: function() {
this.nodeUI.resetStateClass('selected')
.nodeUI.redraw();
.redraw();
this.closeEditorTooltip();
return this;
},