From: Dan Vanderkam Date: Tue, 2 Jul 2013 03:01:48 +0000 (-0400) Subject: mitigated annotation sqishing w/ min-width X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=00355a3825d98da69427adbb73ee2b3ab5e25d06;p=dygraphs.git mitigated annotation sqishing w/ min-width --- 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 {