delete legacy code
This commit is contained in:
parent
8da13dcb27
commit
2bfcadecb4
@ -23,7 +23,7 @@ module.exports = {
|
||||
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('toggle-all-windows-visibility', () => windowManager.toggleAllWindowsVisibility());
|
||||
ipcMain.on('animation-finished', (event) => windowManager.handleAnimationFinished(event.sender));
|
||||
// ipcMain.on('animation-finished', (event) => windowManager.handleAnimationFinished(event.sender));
|
||||
// ipcMain.handle('ask:closeAskWindow', () => windowManager.closeAskWindow());
|
||||
},
|
||||
|
||||
|
@ -253,7 +253,7 @@ contextBridge.exposeInMainWorld('api', {
|
||||
// src/ui/app/content.html inline scripts
|
||||
content: {
|
||||
// Animation Management
|
||||
sendAnimationFinished: () => ipcRenderer.send('animation-finished'),
|
||||
// sendAnimationFinished: () => ipcRenderer.send('animation-finished'),
|
||||
|
||||
// Listeners
|
||||
onSettingsWindowHideAnimation: (callback) => ipcRenderer.on('settings-window-hide-animation', callback),
|
||||
|
@ -98,58 +98,6 @@
|
||||
contain: layout style paint;
|
||||
transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.25s ease-out;
|
||||
}
|
||||
|
||||
.settings-window-show {
|
||||
animation: settingsPopFromButton 0.12s cubic-bezier(0.23, 1, 0.32, 1) forwards;
|
||||
transform-origin: 85% 0%;
|
||||
will-change: transform, opacity;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
.settings-window-hide {
|
||||
animation: settingsCollapseToButton 0.10s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
|
||||
transform-origin: 85% 0%;
|
||||
will-change: transform, opacity;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
@keyframes settingsPopFromButton {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translate3d(0, -8px, 0) scale3d(0.5, 0.5, 1);
|
||||
}
|
||||
40% {
|
||||
opacity: 0.8;
|
||||
transform: translate3d(0, -2px, 0) scale3d(1.05, 1.05, 1);
|
||||
}
|
||||
70% {
|
||||
opacity: 0.95;
|
||||
transform: translate3d(0, 0, 0) scale3d(1.02, 1.02, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes settingsCollapseToButton {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
|
||||
}
|
||||
30% {
|
||||
opacity: 0.8;
|
||||
transform: translate3d(0, -1px, 0) scale3d(0.9, 0.9, 1);
|
||||
}
|
||||
70% {
|
||||
opacity: 0.3;
|
||||
transform: translate3d(0, -5px, 0) scale3d(0.7, 0.7, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translate3d(0, -8px, 0) scale3d(0.5, 0.5, 1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -163,26 +111,6 @@
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const app = document.getElementById('pickle-glass');
|
||||
|
||||
if (window.api) {
|
||||
app.addEventListener('animationend', (event) => {
|
||||
if (event.animationName === 'settingsCollapseToButton') {
|
||||
console.log('Settings hide animation finished. Notifying main process.');
|
||||
window.api.content.sendAnimationFinished();
|
||||
|
||||
app.classList.remove('settings-window-hide');
|
||||
app.classList.add('hidden');
|
||||
}
|
||||
else if (event.animationName === 'settingsPopFromButton') {
|
||||
app.classList.remove('settings-window-show');
|
||||
}
|
||||
});
|
||||
|
||||
window.api.content.onSettingsWindowHideAnimation(() => {
|
||||
console.log('Starting settings window hide animation');
|
||||
app.classList.remove('settings-window-show');
|
||||
app.classList.add('settings-window-hide');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
@ -64,6 +64,8 @@ class WindowLayoutManager {
|
||||
if (!askVis && !listenVis) return {};
|
||||
|
||||
const PAD = 8;
|
||||
const headerTopRel = headerBounds.y - workAreaY;
|
||||
const headerBottomRel = headerTopRel + headerBounds.height;
|
||||
const headerCenterXRel = headerBounds.x - workAreaX + headerBounds.width / 2;
|
||||
|
||||
const relativeX = headerCenterXRel / screenWidth;
|
||||
@ -88,24 +90,33 @@ class WindowLayoutManager {
|
||||
listenXRel = askXRel - listenB.width - PAD;
|
||||
}
|
||||
|
||||
const yPos = (strategy.primary === 'above') ?
|
||||
(headerBounds.y - workAreaY) - Math.max(askB.height, listenB.height) - PAD :
|
||||
(headerBounds.y - workAreaY) + headerBounds.height + PAD;
|
||||
// [수정] 'above'일 경우 하단 정렬, 'below'일 경우 상단 정렬
|
||||
if (strategy.primary === 'above') {
|
||||
const windowBottomAbs = headerBounds.y - PAD;
|
||||
const askY = windowBottomAbs - askB.height;
|
||||
const listenY = windowBottomAbs - listenB.height;
|
||||
result.ask = { x: Math.round(askXRel + workAreaX), y: Math.round(askY) };
|
||||
result.listen = { x: Math.round(listenXRel + workAreaX), y: Math.round(listenY) };
|
||||
} else { // 'below'
|
||||
const yPos = headerBottomRel + PAD;
|
||||
const yAbs = yPos + workAreaY;
|
||||
|
||||
result.listen = { x: Math.round(listenXRel + workAreaX), y: Math.round(yAbs) };
|
||||
result.ask = { x: Math.round(askXRel + workAreaX), y: Math.round(yAbs) };
|
||||
result.listen = { x: Math.round(listenXRel + workAreaX), y: Math.round(yAbs) };
|
||||
}
|
||||
|
||||
} else {
|
||||
} else { // 한 창만 보일 때는 기존 로직 유지 (정상 동작 확인)
|
||||
const winB = askVis ? askB : listenB;
|
||||
let xRel = headerCenterXRel - winB.width / 2;
|
||||
|
||||
let yPos = (strategy.primary === 'above') ?
|
||||
(headerBounds.y - workAreaY) - winB.height - PAD :
|
||||
(headerBounds.y - workAreaY) + headerBounds.height + PAD;
|
||||
|
||||
xRel = Math.max(PAD, Math.min(screenWidth - winB.width - PAD, xRel));
|
||||
|
||||
let yPos;
|
||||
if (strategy.primary === 'above') {
|
||||
const windowBottomRel = headerTopRel - PAD;
|
||||
yPos = windowBottomRel - winB.height;
|
||||
} else { // 'below'
|
||||
yPos = headerBottomRel + PAD;
|
||||
}
|
||||
|
||||
const abs = { x: Math.round(xRel + workAreaX), y: Math.round(yPos + workAreaY) };
|
||||
if (askVis) result.ask = abs;
|
||||
if (listenVis) result.listen = abs;
|
||||
@ -113,37 +124,6 @@ class WindowLayoutManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {{listen: {x:number, y:number}}}
|
||||
*/
|
||||
getTargetBoundsForListenNextToAsk() {
|
||||
const ask = this.windowPool.get('ask');
|
||||
const listen = this.windowPool.get('listen');
|
||||
const header = this.windowPool.get('header');
|
||||
|
||||
if (!ask || !listen || !header || !ask.isVisible() || ask.isDestroyed() || listen.isDestroyed()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const askB = ask.getBounds();
|
||||
const listenB = listen.getBounds();
|
||||
const PAD = 8;
|
||||
|
||||
const listenX = askB.x - listenB.width - PAD;
|
||||
const listenY = askB.y;
|
||||
|
||||
const display = getCurrentDisplay(header);
|
||||
const { x: workAreaX } = display.workArea;
|
||||
|
||||
return {
|
||||
listen: {
|
||||
x: Math.max(workAreaX + PAD, listenX),
|
||||
y: listenY
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
positionWindows() {
|
||||
const header = this.windowPool.get('header');
|
||||
if (!header?.getBounds) return;
|
||||
@ -201,7 +181,10 @@ class WindowLayoutManager {
|
||||
if (!askVisible && !listenVisible) return;
|
||||
|
||||
const PAD = 8;
|
||||
const headerTopRel = headerBounds.y - workAreaY;
|
||||
const headerBottomRel = headerTopRel + headerBounds.height;
|
||||
const headerCenterXRel = headerBounds.x - workAreaX + headerBounds.width / 2;
|
||||
|
||||
let askBounds = askVisible ? ask.getBounds() : null;
|
||||
let listenBounds = listenVisible ? listen.getBounds() : null;
|
||||
|
||||
@ -218,22 +201,33 @@ class WindowLayoutManager {
|
||||
listenXRel = askXRel - listenBounds.width - PAD;
|
||||
}
|
||||
|
||||
const yPos = (strategy.primary === 'above')
|
||||
? (headerBounds.y - workAreaY) - Math.max(askBounds.height, listenBounds.height) - PAD
|
||||
: (headerBounds.y - workAreaY) + headerBounds.height + PAD;
|
||||
// [수정] 'above'일 경우 하단 정렬, 'below'일 경우 상단 정렬
|
||||
if (strategy.primary === 'above') {
|
||||
const windowBottomAbs = headerBounds.y - PAD;
|
||||
const askY = windowBottomAbs - askBounds.height;
|
||||
const listenY = windowBottomAbs - listenBounds.height;
|
||||
ask.setBounds({ x: Math.round(askXRel + workAreaX), y: Math.round(askY), width: askBounds.width, height: askBounds.height });
|
||||
listen.setBounds({ x: Math.round(listenXRel + workAreaX), y: Math.round(listenY), width: listenBounds.width, height: listenBounds.height });
|
||||
} else { // 'below'
|
||||
const yPos = headerBottomRel + PAD;
|
||||
const yAbs = yPos + workAreaY;
|
||||
|
||||
listen.setBounds({ x: Math.round(listenXRel + workAreaX), y: Math.round(yAbs), width: listenBounds.width, height: listenBounds.height });
|
||||
ask.setBounds({ x: Math.round(askXRel + workAreaX), y: Math.round(yAbs), width: askBounds.width, height: askBounds.height });
|
||||
} else {
|
||||
listen.setBounds({ x: Math.round(listenXRel + workAreaX), y: Math.round(yAbs), width: listenBounds.width, height: listenBounds.height });
|
||||
}
|
||||
|
||||
} else { // 한 창만 보일 때는 기존 로직 유지 (정상 동작 확인)
|
||||
const win = askVisible ? ask : listen;
|
||||
const winBounds = askVisible ? askBounds : listenBounds;
|
||||
let xRel = headerCenterXRel - winBounds.width / 2;
|
||||
let yPos = (strategy.primary === 'above')
|
||||
? (headerBounds.y - workAreaY) - winBounds.height - PAD
|
||||
: (headerBounds.y - workAreaY) + headerBounds.height + PAD;
|
||||
|
||||
xRel = Math.max(PAD, Math.min(screenWidth - winBounds.width - PAD, xRel));
|
||||
|
||||
let yPos;
|
||||
if (strategy.primary === 'above') {
|
||||
const windowBottomRel = headerTopRel - PAD;
|
||||
yPos = windowBottomRel - winBounds.height;
|
||||
} else { // 'below'
|
||||
yPos = headerBottomRel + PAD;
|
||||
}
|
||||
const yAbs = yPos + workAreaY;
|
||||
|
||||
win.setBounds({ x: Math.round(xRel + workAreaX), y: Math.round(yAbs), width: winBounds.width, height: winBounds.height });
|
||||
|
@ -39,7 +39,6 @@ const DEFAULT_WINDOW_WIDTH = 353;
|
||||
|
||||
let currentHeaderState = 'apikey';
|
||||
const windowPool = new Map();
|
||||
let fixedYPosition = 0;
|
||||
|
||||
let settingsHideTimer = null;
|
||||
|
||||
@ -109,14 +108,18 @@ async function handleWindowVisibilityRequest(windowPool, layoutManager, movement
|
||||
movementManager.animateWindow(win, targets.listen.x, targets.listen.y);
|
||||
|
||||
} else {
|
||||
const targets = layoutManager.getTargetBoundsForListenNextToAsk();
|
||||
if (!targets.listen) return;
|
||||
const targets = layoutManager.getTargetBoundsForFeatureWindows({ listen: true, ask: true });
|
||||
if (!targets.listen || !targets.ask) return;
|
||||
|
||||
const startPos = { x: targets.listen.x - ANIM_OFFSET_X, y: targets.listen.y };
|
||||
win.setBounds(startPos);
|
||||
// 'listen'은 목표 위치의 왼쪽에서 시작
|
||||
const startListenPos = { x: targets.listen.x - ANIM_OFFSET_X, y: targets.listen.y };
|
||||
win.setBounds(startListenPos);
|
||||
|
||||
// 'listen'을 보여주고 두 창을 동시에 애니메이션
|
||||
win.show();
|
||||
win.setOpacity(1);
|
||||
movementManager.animateWindow(win, targets.listen.x, targets.listen.y);
|
||||
movementManager.animateWindow(otherWin, targets.ask.x, targets.ask.y); // 'ask' 창을 새 위치로 이동
|
||||
movementManager.animateWindow(win, targets.listen.x, targets.listen.y); // 'listen' 창을 새 위치로 이동
|
||||
}
|
||||
} else if (name === 'ask') {
|
||||
if (!isOtherWinVisible) {
|
||||
@ -178,21 +181,6 @@ async function handleWindowVisibilityRequest(windowPool, layoutManager, movement
|
||||
}
|
||||
}
|
||||
|
||||
const handleAnimationFinished = (sender) => {
|
||||
const win = BrowserWindow.fromWebContents(sender);
|
||||
if (win && !win.isDestroyed()) {
|
||||
console.log(`[WindowManager] Hiding window after animation.`);
|
||||
win.hide();
|
||||
const listenWin = windowPool.get('listen');
|
||||
const askWin = windowPool.get('ask');
|
||||
|
||||
if (win === askWin && listenWin && !listenWin.isDestroyed() && listenWin.isVisible()) {
|
||||
console.log('[WindowManager] Ask window hidden, moving listen window to center.');
|
||||
listenWin.webContents.send('listen-window-move-to-center');
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const setContentProtection = (status) => {
|
||||
isContentProtectionOn = status;
|
||||
@ -842,7 +830,6 @@ module.exports = {
|
||||
updateLayout,
|
||||
createWindows,
|
||||
windowPool,
|
||||
fixedYPosition,
|
||||
toggleContentProtection,
|
||||
resizeHeaderWindow,
|
||||
getContentProtectionStatus,
|
||||
@ -860,5 +847,4 @@ module.exports = {
|
||||
moveHeader,
|
||||
moveHeaderTo,
|
||||
adjustWindowHeight,
|
||||
handleAnimationFinished,
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user