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.handle('get-header-position', () => windowManager.getHeaderPosition());
 | 
			
		||||
    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) {
 | 
			
		||||
 | 
			
		||||
@ -148,7 +148,7 @@ contextBridge.exposeInMainWorld('api', {
 | 
			
		||||
  askView: {
 | 
			
		||||
    // Window Management
 | 
			
		||||
    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
 | 
			
		||||
    sendMessage: (text) => ipcRenderer.invoke('ask:sendQuestionFromAsk', text),
 | 
			
		||||
@ -173,7 +173,7 @@ contextBridge.exposeInMainWorld('api', {
 | 
			
		||||
  // src/ui/listen/ListenView.js
 | 
			
		||||
  listenView: {
 | 
			
		||||
    // Window Management
 | 
			
		||||
    adjustWindowHeight: (height) => ipcRenderer.invoke('adjust-window-height', height),
 | 
			
		||||
    adjustWindowHeight: (winName, height) => ipcRenderer.invoke('adjust-window-height', { winName, height }),
 | 
			
		||||
    
 | 
			
		||||
    // Listeners
 | 
			
		||||
    onSessionStateChanged: (callback) => ipcRenderer.on('session-state-changed', callback),
 | 
			
		||||
 | 
			
		||||
@ -503,6 +503,7 @@ export class AskView extends LitElement {
 | 
			
		||||
            padding: 0;
 | 
			
		||||
            height: 0;
 | 
			
		||||
            overflow: hidden;
 | 
			
		||||
            border-top: none;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .text-input-container.no-response {
 | 
			
		||||
@ -1421,7 +1422,7 @@ export class AskView extends LitElement {
 | 
			
		||||
 | 
			
		||||
            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));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -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`
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                window.api.listenView.adjustWindowHeight(targetHeight);
 | 
			
		||||
                window.api.listenView.adjustWindowHeight('listen', targetHeight);
 | 
			
		||||
            })
 | 
			
		||||
            .catch(error => {
 | 
			
		||||
                console.error('Error in adjustWindowHeight:', error);
 | 
			
		||||
 | 
			
		||||
@ -124,6 +124,7 @@ class WindowLayoutManager {
 | 
			
		||||
        if (maxHeight > 0) {
 | 
			
		||||
            adjustedHeight = Math.min(maxHeight, adjustedHeight);
 | 
			
		||||
        }
 | 
			
		||||
        console.log(`[Layout Debug] calculateWindowHeightAdjustment: targetHeight=${targetHeight}`);
 | 
			
		||||
        return { ...currentBounds, height: adjustedHeight };
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ let movementManager = null;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function updateChildWindowLayouts(animated = true) {
 | 
			
		||||
    if (movementManager.isAnimating) return;
 | 
			
		||||
    // if (movementManager.isAnimating) return;
 | 
			
		||||
 | 
			
		||||
    const visibleWindows = {};
 | 
			
		||||
    const listenWin = windowPool.get('listen');
 | 
			
		||||
@ -96,8 +96,8 @@ const moveHeaderTo = (newX, newY) => {
 | 
			
		||||
    internalBridge.emit('window:moveHeaderTo', { newX, newY });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const adjustWindowHeight = (sender, targetHeight) => {
 | 
			
		||||
    internalBridge.emit('window:adjustWindowHeight', { sender, targetHeight });
 | 
			
		||||
const adjustWindowHeight = (winName, targetHeight) => {
 | 
			
		||||
    internalBridge.emit('window:adjustWindowHeight', { winName, targetHeight });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -195,8 +195,9 @@ function setupWindowController(windowPool, layoutManager, movementManager) {
 | 
			
		||||
            header.setPosition(newPosition.x, newPosition.y);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    internalBridge.on('window:adjustWindowHeight', ({ sender, targetHeight }) => {
 | 
			
		||||
        const senderWindow = windowPool.get(sender);
 | 
			
		||||
    internalBridge.on('window:adjustWindowHeight', ({ winName, targetHeight }) => {
 | 
			
		||||
        console.log(`[Layout Debug] adjustWindowHeight: targetHeight=${targetHeight}`);
 | 
			
		||||
        const senderWindow = windowPool.get(winName);
 | 
			
		||||
        if (senderWindow) {
 | 
			
		||||
            const newBounds = layoutManager.calculateWindowHeightAdjustment(senderWindow, targetHeight);
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user