fix auto adujusting height
This commit is contained in:
		
							parent
							
								
									60a8c30157
								
							
						
					
					
						commit
						7455907835
					
				@ -25,7 +25,7 @@ module.exports = {
 | 
				
			|||||||
    ipcMain.on('header-animation-finished', (event, state) => windowManager.handleHeaderAnimationFinished(state));
 | 
					    ipcMain.on('header-animation-finished', (event, state) => windowManager.handleHeaderAnimationFinished(state));
 | 
				
			||||||
    ipcMain.handle('get-header-position', () => windowManager.getHeaderPosition());
 | 
					    ipcMain.handle('get-header-position', () => windowManager.getHeaderPosition());
 | 
				
			||||||
    ipcMain.handle('move-header-to', (event, newX, newY) => windowManager.moveHeaderTo(newX, newY));
 | 
					    ipcMain.handle('move-header-to', (event, newX, newY) => windowManager.moveHeaderTo(newX, newY));
 | 
				
			||||||
    ipcMain.handle('adjust-window-height', (event, targetHeight) => windowManager.adjustWindowHeight(event.sender, targetHeight));
 | 
					    ipcMain.handle('adjust-window-height', (event, { winName, height }) => windowManager.adjustWindowHeight(winName, height));
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  notifyFocusChange(win, isFocused) {
 | 
					  notifyFocusChange(win, isFocused) {
 | 
				
			||||||
 | 
				
			|||||||
@ -148,7 +148,7 @@ contextBridge.exposeInMainWorld('api', {
 | 
				
			|||||||
  askView: {
 | 
					  askView: {
 | 
				
			||||||
    // Window Management
 | 
					    // Window Management
 | 
				
			||||||
    closeAskWindow: () => ipcRenderer.invoke('ask:closeAskWindow'),
 | 
					    closeAskWindow: () => ipcRenderer.invoke('ask:closeAskWindow'),
 | 
				
			||||||
    adjustWindowHeight: (height) => ipcRenderer.invoke('adjust-window-height', height),
 | 
					    adjustWindowHeight: (winName, height) => ipcRenderer.invoke('adjust-window-height', { winName, height }),
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    // Message Handling
 | 
					    // Message Handling
 | 
				
			||||||
    sendMessage: (text) => ipcRenderer.invoke('ask:sendQuestionFromAsk', text),
 | 
					    sendMessage: (text) => ipcRenderer.invoke('ask:sendQuestionFromAsk', text),
 | 
				
			||||||
@ -173,7 +173,7 @@ contextBridge.exposeInMainWorld('api', {
 | 
				
			|||||||
  // src/ui/listen/ListenView.js
 | 
					  // src/ui/listen/ListenView.js
 | 
				
			||||||
  listenView: {
 | 
					  listenView: {
 | 
				
			||||||
    // Window Management
 | 
					    // Window Management
 | 
				
			||||||
    adjustWindowHeight: (height) => ipcRenderer.invoke('adjust-window-height', height),
 | 
					    adjustWindowHeight: (winName, height) => ipcRenderer.invoke('adjust-window-height', { winName, height }),
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    // Listeners
 | 
					    // Listeners
 | 
				
			||||||
    onSessionStateChanged: (callback) => ipcRenderer.on('session-state-changed', callback),
 | 
					    onSessionStateChanged: (callback) => ipcRenderer.on('session-state-changed', callback),
 | 
				
			||||||
 | 
				
			|||||||
@ -503,6 +503,7 @@ export class AskView extends LitElement {
 | 
				
			|||||||
            padding: 0;
 | 
					            padding: 0;
 | 
				
			||||||
            height: 0;
 | 
					            height: 0;
 | 
				
			||||||
            overflow: hidden;
 | 
					            overflow: hidden;
 | 
				
			||||||
 | 
					            border-top: none;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        .text-input-container.no-response {
 | 
					        .text-input-container.no-response {
 | 
				
			||||||
@ -1421,7 +1422,7 @@ export class AskView extends LitElement {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            const targetHeight = Math.min(700, idealHeight);
 | 
					            const targetHeight = Math.min(700, idealHeight);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            window.api.askView.adjustWindowHeight(targetHeight);
 | 
					            window.api.askView.adjustWindowHeight("ask", targetHeight);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }).catch(err => console.error('AskView adjustWindowHeight error:', err));
 | 
					        }).catch(err => console.error('AskView adjustWindowHeight error:', err));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -536,7 +536,7 @@ export class ListenView extends LitElement {
 | 
				
			|||||||
                    `[Height Adjusted] Mode: ${this.viewMode}, TopBar: ${topBarHeight}px, Content: ${contentHeight}px, Ideal: ${idealHeight}px, Target: ${targetHeight}px`
 | 
					                    `[Height Adjusted] Mode: ${this.viewMode}, TopBar: ${topBarHeight}px, Content: ${contentHeight}px, Ideal: ${idealHeight}px, Target: ${targetHeight}px`
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                window.api.listenView.adjustWindowHeight(targetHeight);
 | 
					                window.api.listenView.adjustWindowHeight('listen', targetHeight);
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            .catch(error => {
 | 
					            .catch(error => {
 | 
				
			||||||
                console.error('Error in adjustWindowHeight:', error);
 | 
					                console.error('Error in adjustWindowHeight:', error);
 | 
				
			||||||
 | 
				
			|||||||
@ -124,6 +124,7 @@ class WindowLayoutManager {
 | 
				
			|||||||
        if (maxHeight > 0) {
 | 
					        if (maxHeight > 0) {
 | 
				
			||||||
            adjustedHeight = Math.min(maxHeight, adjustedHeight);
 | 
					            adjustedHeight = Math.min(maxHeight, adjustedHeight);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        console.log(`[Layout Debug] calculateWindowHeightAdjustment: targetHeight=${targetHeight}`);
 | 
				
			||||||
        return { ...currentBounds, height: adjustedHeight };
 | 
					        return { ...currentBounds, height: adjustedHeight };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,7 @@ let movementManager = null;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function updateChildWindowLayouts(animated = true) {
 | 
					function updateChildWindowLayouts(animated = true) {
 | 
				
			||||||
    if (movementManager.isAnimating) return;
 | 
					    // if (movementManager.isAnimating) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const visibleWindows = {};
 | 
					    const visibleWindows = {};
 | 
				
			||||||
    const listenWin = windowPool.get('listen');
 | 
					    const listenWin = windowPool.get('listen');
 | 
				
			||||||
@ -96,8 +96,8 @@ const moveHeaderTo = (newX, newY) => {
 | 
				
			|||||||
    internalBridge.emit('window:moveHeaderTo', { newX, newY });
 | 
					    internalBridge.emit('window:moveHeaderTo', { newX, newY });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const adjustWindowHeight = (sender, targetHeight) => {
 | 
					const adjustWindowHeight = (winName, targetHeight) => {
 | 
				
			||||||
    internalBridge.emit('window:adjustWindowHeight', { sender, targetHeight });
 | 
					    internalBridge.emit('window:adjustWindowHeight', { winName, targetHeight });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -195,8 +195,9 @@ function setupWindowController(windowPool, layoutManager, movementManager) {
 | 
				
			|||||||
            header.setPosition(newPosition.x, newPosition.y);
 | 
					            header.setPosition(newPosition.x, newPosition.y);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    internalBridge.on('window:adjustWindowHeight', ({ sender, targetHeight }) => {
 | 
					    internalBridge.on('window:adjustWindowHeight', ({ winName, targetHeight }) => {
 | 
				
			||||||
        const senderWindow = windowPool.get(sender);
 | 
					        console.log(`[Layout Debug] adjustWindowHeight: targetHeight=${targetHeight}`);
 | 
				
			||||||
 | 
					        const senderWindow = windowPool.get(winName);
 | 
				
			||||||
        if (senderWindow) {
 | 
					        if (senderWindow) {
 | 
				
			||||||
            const newBounds = layoutManager.calculateWindowHeightAdjustment(senderWindow, targetHeight);
 | 
					            const newBounds = layoutManager.calculateWindowHeightAdjustment(senderWindow, targetHeight);
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user