From 00355a3825d98da69427adbb73ee2b3ab5e25d06 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 1 Jul 2013 23:01:48 -0400 Subject: [PATCH] mitigated annotation sqishing w/ min-width --- extras/super-annotations.js | 2 ++ tests/hairlines.html | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/extras/super-annotations.js b/extras/super-annotations.js index efc0aac..a63d8eb 100644 --- a/extras/super-annotations.js +++ b/extras/super-annotations.js @@ -97,6 +97,7 @@ annotations.prototype.makeAnnotationEditable = function(a) { a.editable = true; var editableTemplateDiv = $('#annotation-editable-template').get(0); a.infoDiv.innerHTML = this.getTemplateHTML(editableTemplateDiv, a); + $(a.infoDiv).toggleClass('editable', !!a.editable); $(this).triggerHandler('beganEditAnnotation', a); }; @@ -284,6 +285,7 @@ annotations.prototype.updateAnnotationInfo = function() { $.each(this.annotations_, function(idx, a) { // We should never update an editable div -- doing so may kill unsaved // edits to an annotation. + $(a.infoDiv).toggleClass('editable', !!a.editable); if (a.editable) return; a.infoDiv.innerHTML = that.getTemplateHTML(templateDiv, a); }); diff --git a/tests/hairlines.html b/tests/hairlines.html index 8318602..fcdf3f8 100644 --- a/tests/hairlines.html +++ b/tests/hairlines.html @@ -83,6 +83,11 @@ display: table; /* shrink to fit */ box-shadow: 0 0 4px gray; cursor: move; + + min-width: 120px; /* prevents squishing at the right edge of the chart */ + } + .annotation-info.editable { + min-width: 180px; /* prevents squishing at the right edge of the chart */ } .dygraph-annotation-line { -- 2.7.4