Fossil SCM
chat: corrected the scroll position tracking when toggling single/multi-line mode to work from arbitrary points within the scroll area.
Commit
0f59fba08a141f3663072c7bb590de243d329c6dec8e9b1f2b7fd7834a9fea97
Parent
423ee8101a28fb2…
1 file changed
+5
-3
+5
-3
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -149,15 +149,17 @@ | ||
| 149 | 149 | if(this.e.inputCurrent === this.e.inputSingle){ |
| 150 | 150 | this.e.inputCurrent = this.e.inputMulti; |
| 151 | 151 | }else{ |
| 152 | 152 | this.e.inputCurrent = this.e.inputSingle; |
| 153 | 153 | } |
| 154 | - const ht1 = D.effectiveHeight(old); | |
| 154 | + const m = this.e.messagesWrapper, | |
| 155 | + sTop = m.scrollTop, | |
| 156 | + mh1 = m.clientHeight; | |
| 155 | 157 | D.addClass(old, 'hidden'); |
| 156 | 158 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 157 | - const ht2 = D.effectiveHeight(this.e.inputCurrent); | |
| 158 | - this.e.messagesWrapper.scrollBy(0, ht2 - ht1); | |
| 159 | + const mh2 = m.clientHeight; | |
| 160 | + m.scrollTo( 0, sTop + (mh1-mh2)); | |
| 159 | 161 | this.e.inputCurrent.value = old.value; |
| 160 | 162 | old.value = ''; |
| 161 | 163 | return this; |
| 162 | 164 | }, |
| 163 | 165 | /** Enables (if yes is truthy) or disables all elements in |
| 164 | 166 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -149,15 +149,17 @@ | |
| 149 | if(this.e.inputCurrent === this.e.inputSingle){ |
| 150 | this.e.inputCurrent = this.e.inputMulti; |
| 151 | }else{ |
| 152 | this.e.inputCurrent = this.e.inputSingle; |
| 153 | } |
| 154 | const ht1 = D.effectiveHeight(old); |
| 155 | D.addClass(old, 'hidden'); |
| 156 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 157 | const ht2 = D.effectiveHeight(this.e.inputCurrent); |
| 158 | this.e.messagesWrapper.scrollBy(0, ht2 - ht1); |
| 159 | this.e.inputCurrent.value = old.value; |
| 160 | old.value = ''; |
| 161 | return this; |
| 162 | }, |
| 163 | /** Enables (if yes is truthy) or disables all elements in |
| 164 |
| --- src/chat.js | |
| +++ src/chat.js | |
| @@ -149,15 +149,17 @@ | |
| 149 | if(this.e.inputCurrent === this.e.inputSingle){ |
| 150 | this.e.inputCurrent = this.e.inputMulti; |
| 151 | }else{ |
| 152 | this.e.inputCurrent = this.e.inputSingle; |
| 153 | } |
| 154 | const m = this.e.messagesWrapper, |
| 155 | sTop = m.scrollTop, |
| 156 | mh1 = m.clientHeight; |
| 157 | D.addClass(old, 'hidden'); |
| 158 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 159 | const mh2 = m.clientHeight; |
| 160 | m.scrollTo( 0, sTop + (mh1-mh2)); |
| 161 | this.e.inputCurrent.value = old.value; |
| 162 | old.value = ''; |
| 163 | return this; |
| 164 | }, |
| 165 | /** Enables (if yes is truthy) or disables all elements in |
| 166 |