Browse Source

Fix clearing recent search

Fix scrolling to bubble's center
master
morethanwords 3 years ago
parent
commit
ee7ceb4974
  1. 3
      src/components/call/description.ts
  2. 7
      src/components/chat/bubbles.ts
  3. 1
      src/components/sidebarLeft/index.ts
  4. 6
      src/helpers/fastSmoothScroll.ts

3
src/components/call/description.ts

@ -5,7 +5,6 @@
*/ */
import replaceContent from "../../helpers/dom/replaceContent"; import replaceContent from "../../helpers/dom/replaceContent";
import type CallInstance from "../../lib/calls/callInstance";
import CALL_STATE from "../../lib/calls/callState"; import CALL_STATE from "../../lib/calls/callState";
import { i18n, LangPackKey } from "../../lib/langPack"; import { i18n, LangPackKey } from "../../lib/langPack";
@ -29,7 +28,7 @@ export default class CallDescriptionElement {
this.state = undefined; this.state = undefined;
} }
public update(instance: CallInstance) { public update(instance: any) {
const {connectionState} = instance; const {connectionState} = instance;
if(this.state === connectionState) { if(this.state === connectionState) {

7
src/components/chat/bubbles.ts

@ -1665,11 +1665,12 @@ export default class ChatBubbles {
let fallbackToElementStartWhenCentering: HTMLElement; let fallbackToElementStartWhenCentering: HTMLElement;
// * if it's a start, then scroll to start of the group // * if it's a start, then scroll to start of the group
if(bubble && position !== 'end' && whichChild(bubble) === (this.stickyIntersector ? 2 : 1) && this.chat.setPeerPromise) { if(bubble && position !== 'end' && whichChild(bubble) === (this.stickyIntersector ? 2 : 1)/* && this.chat.setPeerPromise */) {
const dateGroup = bubble.parentElement; const dateGroup = bubble.parentElement;
// if(whichChild(dateGroup) === 0) { // if(whichChild(dateGroup) === 0) {
// fallbackToElementStartWhenCentering = dateGroup; fallbackToElementStartWhenCentering = dateGroup;
element = dateGroup; // position = 'start';
// element = dateGroup;
// } // }
} }

1
src/components/sidebarLeft/index.ts

@ -595,6 +595,7 @@ export class AppSidebarLeft extends SidebarSlider {
appStateManager.releaseSinglePeer(peerId, 'recentSearch'); appStateManager.releaseSinglePeer(peerId, 'recentSearch');
} }
recentSearch.length = 0;
appStateManager.pushToState('recentSearch', recentSearch); appStateManager.pushToState('recentSearch', recentSearch);
}); });
}); });

6
src/helpers/fastSmoothScroll.ts

@ -100,7 +100,7 @@ function scrollWithJs(options: ScrollOptions): Promise<void> {
const containerSize = getNormalSize ? getNormalSize({rect: containerRect}) : containerRect[sizeKey]; const containerSize = getNormalSize ? getNormalSize({rect: containerRect}) : containerRect[sizeKey];
const scrollPosition = container[scrollPositionKey]; let scrollPosition = container[scrollPositionKey];
const scrollSize = container[scrollSizeKey]; const scrollSize = container[scrollSizeKey];
/* const elementPosition = element.offsetTop; /* const elementPosition = element.offsetTop;
const elementSize = element.offsetHeight; const elementSize = element.offsetHeight;
@ -154,10 +154,10 @@ function scrollWithJs(options: ScrollOptions): Promise<void> {
if(axis === 'y') { if(axis === 'y') {
if(forceDirection === undefined) { if(forceDirection === undefined) {
if(path > maxDistance) { if(path > maxDistance) {
container.scrollTop += path - maxDistance; scrollPosition = container.scrollTop += path - maxDistance;
path = maxDistance; path = maxDistance;
} else if(path < -maxDistance) { } else if(path < -maxDistance) {
container.scrollTop += path + maxDistance; scrollPosition = container.scrollTop += path + maxDistance;
path = -maxDistance; path = -maxDistance;
} }
}/* else if(forceDirection === FocusDirection.Up) { // * not tested yet }/* else if(forceDirection === FocusDirection.Up) { // * not tested yet

Loading…
Cancel
Save