Handle tooltip clash

This commit is contained in:
mattpass
2020-07-23 21:04:57 +01:00
parent 611556b5fe
commit 35bcb14d8d
2 changed files with 12 additions and 6 deletions

View File

@@ -14,14 +14,10 @@
position: fixed;
white-space: pre;
white-space: pre-wrap;
margin: 0 0 0 5px;
z-index: 100;
max-width: 600px;
opacity: 0;
transition: opacity .4s;
-moz-transition: opacity .4s;
-webkit-transition: opacity .4s;
-o-transition: opacity .4s;
-ms-transition: opacity .4s;
}
.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {

View File

@@ -741,6 +741,8 @@ var ICEcoder = {
// Show function args tooltip
functionArgsTooltip: function(e, area) {
let numLintErrors;
if (this.indexData) {
// If we have no files open, return early
if (0 === this.openFiles.length) {
@@ -776,7 +778,15 @@ var ICEcoder = {
if (1 === numResults && -1 === [null, "def"].indexOf(cM.getTokenTypeAt(coordsChar))) {
get('tooltip').style.display = "block";
get('tooltip').style.left = (this.mouseX - this.maxFilesW + 10) + "px";
get('tooltip').style.top = (this.mouseY - 30) + "px";
numLintErrors = this.content.contentWindow.document.getElementsByClassName("CodeMirror-lint-tooltip")[0];
numLintErrors = numLintErrors && numLintErrors.childNodes
? numLintErrors.childNodes.length
: 0;
get('tooltip').style.top = (this.mouseY - 30 -
(0 < numLintErrors
? 18 * numLintErrors
: 0)
) + "px";
get('tooltip').style.zIndex = "1";
get('tooltip').innerHTML = result.params;
// Else hide it