Grammalecte  Diff

Differences From Artifact [811e4142bb]:

To Artifact [84014faa6e]:


67
68
69
70
71
72
73


74
75


76
77
78
79
80
81
82
67
68
69
70
71
72
73
74
75


76
77
78
79
80
81
82
83
84







+
+
-
-
+
+







    _createButtons () {
        let xButtonLine = oGrammalecte.createNode("div", {className: "grammalecte_panel_commands"});
        xButtonLine.appendChild(this.xWaitIcon);
        if (this.sId === "grammalecte_gc_panel") {
            xButtonLine.appendChild(this._createCopyButton());
        }
        if (this.bFlexible) {
            this.xWidthButton = this._createMoveButton("changeWidth", "L", "Étendre en largeur");
            this.xHeightButton = this._createMoveButton("changeHeight", "H", "Étendre en hauteur");
            xButtonLine.appendChild(this._createMoveButton("changeWidth", "⭾", "Bascule la largeur"));
            xButtonLine.appendChild(this._createMoveButton("changeHeight", "⭿", "Bascule la hauteur"));
            xButtonLine.appendChild(this.xWidthButton);
            xButtonLine.appendChild(this.xHeightButton);
        }
        xButtonLine.appendChild(this._createMoveButton("up", " ", "Monter")); // use char ⏶ when Windows 10 be vast majority of OS (Trebuchet MS not updated on other OS)
        xButtonLine.appendChild(this._createMoveButton("left", " ", "À gauche")); // use char ⏴ when Windows 10 be vast majority of OS (Trebuchet MS not updated on other OS)
        xButtonLine.appendChild(this._createMoveButton("center", " ", "Centrer")); // char • can be used already
        xButtonLine.appendChild(this._createMoveButton("right", " ", "À droite")); // use char ⏵ when Windows 10 be vast majority of OS (Trebuchet MS not updated on other OS)
        xButtonLine.appendChild(this._createMoveButton("down", " ", "Descendre")); // use char ⏷ when Windows 10 be vast majority of OS (Trebuchet MS not updated on other OS)
        this.xCloseButton = this._createCloseButton();
178
179
180
181
182
183
184




185
186
187
188







189
190


191
192
193
194
195
196
197
180
181
182
183
184
185
186
187
188
189
190




191
192
193
194
195
196
197


198
199
200
201
202
203
204
205
206







+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+







    changeHeight () {
        this.bVertStrech = !this.bVertStrech;
        this.setSizeAndPosition();
    }

    setSizeAndPosition () {
        // size
        if (this.xWidthButton && this.xHeightButton) {
            this.xWidthButton.style.opacity = (this.bHorizStrech) ? .9 : .5;
            this.xHeightButton.style.opacity = (this.bVertStrech) ? .9 : .5;
        }
        let nWidth = (this.bFlexible && this.bHorizStrech) ? Math.min(this.nWidth*1.5, window.innerWidth-200) : Math.min(this.nWidth, window.innerWidth-200);
        let nHeight = this.nHeight;
        if ([4, 5, 6].includes(this.nPosition)) {
            nHeight = (this.bFlexible && this.bVertStrech) ? (window.innerHeight-100) : Math.min(window.innerHeight-100, this.nHeight);
        let nWidth = Math.min(this.nWidth, window.innerWidth-200);
        let nHeight = ([4, 5, 6].includes(this.nPosition)) ? Math.min(this.nHeight, window.innerHeight-100) : Math.floor(window.innerHeight*0.45);
        if (this.bFlexible) {
            if (this.bHorizStrech) {
                nWidth = Math.min(this.nWidth*1.33, window.innerWidth-200);
            }
            if (this.bVertStrech) {
        } else {
            nHeight = (this.bFlexible) ? Math.floor(window.innerHeight*0.45) : this.nHeight;
                nHeight = ([4, 5, 6].includes(this.nPosition)) ? (window.innerHeight-100) : Math.floor(window.innerHeight*0.67);
            }
        }
        this.xPanel.style.width = `${nWidth}px`;
        this.xPanel.style.height = `${nHeight}px`;
        // position
        let oPos = null;
        switch (this.nPosition) {
            case 1: oPos = { top:"",     right:"",     bottom:"-2px", left:"-2px", marginTop:"",                marginLeft:"" }; break;