Skip to content

Commit

Permalink
Adjust background when changing sidebar width
Browse files Browse the repository at this point in the history
  • Loading branch information
H7GhosT committed Dec 21, 2024
1 parent 164d44c commit 8eca6fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/components/sidebarLeft/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ export class AppSidebarLeft extends SidebarSlider {
const isCollapsed = !this.hasTabsInNavigation() && !this.isSearchActive && width < MIN_SIDEBAR_WIDTH * 0.65;
this.sidebarEl.classList.toggle('is-collapsed', isCollapsed);

appImManager.adjustChatPatternBackground();

throttledSetToStorage(isCollapsed ? 0 : clampedWidth);
},
onReset: () => {
Expand Down
21 changes: 12 additions & 9 deletions src/lib/appManagers/appImManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,13 @@ export class AppImManager extends EventListenerBase<{

mediaSizes.addEventListener('resize', () => {
// const perf = performance.now();
const rect = this.chatsContainer.getBoundingClientRect();
ChatBackgroundPatternRenderer.resizeInstances(rect.width, rect.height).then(() => {
// this.log.warn('resize bg time:', performance.now() - perf);
// for(const chat of this.chats) {
// if(chat.renderDarkPattern) {
// chat.renderDarkPattern();
// }
// }
});
this.adjustChatPatternBackground();
// this.log.warn('resize bg time:', performance.now() - perf);
// for(const chat of this.chats) {
// if(chat.renderDarkPattern) {
// chat.renderDarkPattern();
// }
// }
});

const onPeerChanging = (chat: Chat) => {
Expand Down Expand Up @@ -691,6 +689,11 @@ export class AppImManager extends EventListenerBase<{
// PopupElement.createPopup(PopupBoostsViaGifts, -5000866300);
}

public adjustChatPatternBackground() {
const rect = this.chatsContainer.getBoundingClientRect();
ChatBackgroundPatternRenderer.resizeInstances(rect.width, rect.height);
}

private checkForShare() {
const share = apiManagerProxy.share;
if(share) {
Expand Down

0 comments on commit 8eca6fd

Please sign in to comment.