:recycle: [Refactor] Move ChatSessionContainerScrollBinder to SreenScroller.bind()
Browse files- components/buttons_binder.js +0 -14
- storage/states.js +9 -1
components/buttons_binder.js
CHANGED
|
@@ -23,9 +23,6 @@ export class ButtonsBinder {
|
|
| 23 |
show_endpoint_and_key_binder.bind();
|
| 24 |
let scroll_to_bottom_binder = new ScrollToBottomButtonBinder();
|
| 25 |
scroll_to_bottom_binder.bind();
|
| 26 |
-
let chat_session_container_scroll_binder =
|
| 27 |
-
new ChatSessionContainerScrollBinder();
|
| 28 |
-
chat_session_container_scroll_binder.bind();
|
| 29 |
let screenshot_button_binder = new ScreenshotButtonBinder();
|
| 30 |
screenshot_button_binder.bind();
|
| 31 |
let available_models_select_binder = new AvailableModelsSelectBinder();
|
|
@@ -189,17 +186,6 @@ class ScrollToBottomButtonBinder {
|
|
| 189 |
}
|
| 190 |
}
|
| 191 |
|
| 192 |
-
class ChatSessionContainerScrollBinder {
|
| 193 |
-
constructor() {}
|
| 194 |
-
bind() {
|
| 195 |
-
$("#chat-session-container").on("wheel touchmove", function () {
|
| 196 |
-
if ($("#send-user-input").attr("status") === "stop") {
|
| 197 |
-
screen_scroller.set_user_scrolling(true);
|
| 198 |
-
}
|
| 199 |
-
});
|
| 200 |
-
}
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
class ScreenshotButtonBinder {
|
| 204 |
constructor() {}
|
| 205 |
bind() {
|
|
|
|
| 23 |
show_endpoint_and_key_binder.bind();
|
| 24 |
let scroll_to_bottom_binder = new ScrollToBottomButtonBinder();
|
| 25 |
scroll_to_bottom_binder.bind();
|
|
|
|
|
|
|
|
|
|
| 26 |
let screenshot_button_binder = new ScreenshotButtonBinder();
|
| 27 |
screenshot_button_binder.bind();
|
| 28 |
let available_models_select_binder = new AvailableModelsSelectBinder();
|
|
|
|
| 186 |
}
|
| 187 |
}
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
class ScreenshotButtonBinder {
|
| 190 |
constructor() {}
|
| 191 |
bind() {
|
storage/states.js
CHANGED
|
@@ -2,6 +2,14 @@ class ScreenScroller {
|
|
| 2 |
constructor() {
|
| 3 |
this.is_user_scrolling = false;
|
| 4 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
get_user_scrolling() {
|
| 6 |
return this.is_user_scrolling;
|
| 7 |
}
|
|
@@ -12,7 +20,6 @@ class ScreenScroller {
|
|
| 12 |
if (this.get_user_scrolling()) {
|
| 13 |
return;
|
| 14 |
}
|
| 15 |
-
console.log("scroll_to_bottom");
|
| 16 |
if (animate) {
|
| 17 |
$("#chat-session-container").animate(
|
| 18 |
{
|
|
@@ -32,3 +39,4 @@ class ScreenScroller {
|
|
| 32 |
}
|
| 33 |
|
| 34 |
export let screen_scroller = new ScreenScroller();
|
|
|
|
|
|
| 2 |
constructor() {
|
| 3 |
this.is_user_scrolling = false;
|
| 4 |
}
|
| 5 |
+
bind() {
|
| 6 |
+
let self = this;
|
| 7 |
+
$("#chat-session-container").on("wheel touchmove", function () {
|
| 8 |
+
if ($("#send-user-input").attr("status") === "stop") {
|
| 9 |
+
self.set_user_scrolling(true);
|
| 10 |
+
}
|
| 11 |
+
});
|
| 12 |
+
}
|
| 13 |
get_user_scrolling() {
|
| 14 |
return this.is_user_scrolling;
|
| 15 |
}
|
|
|
|
| 20 |
if (this.get_user_scrolling()) {
|
| 21 |
return;
|
| 22 |
}
|
|
|
|
| 23 |
if (animate) {
|
| 24 |
$("#chat-session-container").animate(
|
| 25 |
{
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
export let screen_scroller = new ScreenScroller();
|
| 42 |
+
screen_scroller.bind();
|