Fossil SCM

chat: corrected the scroll position tracking when toggling single/multi-line mode to work from arbitrary points within the scroll area.

stephan 2020-12-28 00:23 trunk
Commit 0f59fba08a141f3663072c7bb590de243d329c6dec8e9b1f2b7fd7834a9fea97
1 file changed +5 -3
+5 -3
--- src/chat.js
+++ src/chat.js
@@ -149,15 +149,17 @@
149149
if(this.e.inputCurrent === this.e.inputSingle){
150150
this.e.inputCurrent = this.e.inputMulti;
151151
}else{
152152
this.e.inputCurrent = this.e.inputSingle;
153153
}
154
- const ht1 = D.effectiveHeight(old);
154
+ const m = this.e.messagesWrapper,
155
+ sTop = m.scrollTop,
156
+ mh1 = m.clientHeight;
155157
D.addClass(old, 'hidden');
156158
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));
159161
this.e.inputCurrent.value = old.value;
160162
old.value = '';
161163
return this;
162164
},
163165
/** Enables (if yes is truthy) or disables all elements in
164166
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button