Grammalecte  Check-in [b2893d0cb3]

Overview
Comment:[fx][bug] tooltip positioning when window is enlarged
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: b2893d0cb3f4f52c06230febecff87d27b280b796e144a37f0086689cceb8560
User & Date: olr on 2017-10-23 10:16:44
Other Links: manifest | tags
Context
2017-10-23
10:22
[fx] don’t display buttons by default check-in: e57f451fec user: olr tags: trunk, fx
10:16
[fx][bug] tooltip positioning when window is enlarged check-in: b2893d0cb3 user: olr tags: trunk, fx
09:41
[fx][bug] CSS: prevent content division to expand if words are too long check-in: ea2cbb3df1 user: olr tags: trunk, fx
Changes

Modified gc_lang/fr/webext/content_scripts/panel.js from [9619f1038a] to [9072191a85].

126
127
128
129
130
131
132




133
134
135
136
137
138
139
        // todo
    }

    adjustHeight () {
        this.xPanelContent.style.height = this.xPanelContent.firstChild.offsetHeight + "px"; // xPanelContent has only one child
        this.xPanel.style.height = this.xPanelBar.offsetHeight + this.xPanelContent.offsetHeight + 10 + "px";
    }





    logInnerHTML () {
        // for debugging
        console.log(this.xPanel.innerHTML);
    }
    
    startWaitIcon () {







>
>
>
>







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
        // todo
    }

    adjustHeight () {
        this.xPanelContent.style.height = this.xPanelContent.firstChild.offsetHeight + "px"; // xPanelContent has only one child
        this.xPanel.style.height = this.xPanelBar.offsetHeight + this.xPanelContent.offsetHeight + 10 + "px";
    }

    getWidth () {
        return this.xPanelContent.offsetWidth;
    }

    logInnerHTML () {
        // for debugging
        console.log(this.xPanel.innerHTML);
    }
    
    startWaitIcon () {

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [4dd7da6950] to [2a56328f4b].

304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
        xContentNode.appendChild(this.xTooltipArrow);
    }

    show (sNodeErrorId) {  // err
        try {
            let xNodeErr = document.getElementById(sNodeErrorId);
            this.sErrorId = xNodeErr.dataset.error_id; // we store error_id here to know if spell_suggestions are given to the right word.
            let nLimit = 500 - 330; // paragraph width - tooltip width
            this.xTooltipArrow.style.top = (xNodeErr.offsetTop + 16) + "px";
            this.xTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((xNodeErr.offsetWidth / 2))-4) + "px"; // 4 is half the width of the arrow.
            this.xTooltip.style.top = (xNodeErr.offsetTop + 20) + "px";
            this.xTooltip.style.left = (xNodeErr.offsetLeft > nLimit) ? nLimit + "px" : xNodeErr.offsetLeft + "px";
            if (xNodeErr.dataset.error_type === "grammar") {
                // grammar error
                if (xNodeErr.dataset.gc_message.includes(" ##")) {







|







304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
        xContentNode.appendChild(this.xTooltipArrow);
    }

    show (sNodeErrorId) {  // err
        try {
            let xNodeErr = document.getElementById(sNodeErrorId);
            this.sErrorId = xNodeErr.dataset.error_id; // we store error_id here to know if spell_suggestions are given to the right word.
            let nLimit = oGrammalecte.oGCPanel.getWidth() - 330; // paragraph width - tooltip width
            this.xTooltipArrow.style.top = (xNodeErr.offsetTop + 16) + "px";
            this.xTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((xNodeErr.offsetWidth / 2))-4) + "px"; // 4 is half the width of the arrow.
            this.xTooltip.style.top = (xNodeErr.offsetTop + 20) + "px";
            this.xTooltip.style.left = (xNodeErr.offsetLeft > nLimit) ? nLimit + "px" : xNodeErr.offsetLeft + "px";
            if (xNodeErr.dataset.error_type === "grammar") {
                // grammar error
                if (xNodeErr.dataset.gc_message.includes(" ##")) {