From 9b616486115414cd831f8a4a3ed7df8d1eedd8dd Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 18 Oct 2012 14:45:00 -0400 Subject: [PATCH] Get infoboxes to toggle and position correctly, repeatedly --- css/app.css | 10 ++++ index.html | 1 + js/iD/controller/edit/EditBaseState.js | 58 +++++++++--------------- js/iD/controller/edit/SelectedPOINode.js | 2 +- 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/css/app.css b/css/app.css index 8838902a5..58c22dd3b 100644 --- a/css/app.css +++ b/css/app.css @@ -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; +} diff --git a/index.html b/index.html index 52a0a61b1..b550390a9 100755 --- a/index.html +++ b/index.html @@ -151,6 +151,7 @@ require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented

 

+ ×
Presets Tags diff --git a/js/iD/controller/edit/EditBaseState.js b/js/iD/controller/edit/EditBaseState.js index 3f9b312d6..e050020b5 100644 --- a/js/iD/controller/edit/EditBaseState.js +++ b/js/iD/controller/edit/EditBaseState.js @@ -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 + " " + - " ", - 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(); + } }); // ---------------------------------------------------------------------- diff --git a/js/iD/controller/edit/SelectedPOINode.js b/js/iD/controller/edit/SelectedPOINode.js index 64e5685dc..eec7a8312 100755 --- a/js/iD/controller/edit/SelectedPOINode.js +++ b/js/iD/controller/edit/SelectedPOINode.js @@ -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; },