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('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, targetHeight) => windowManager.adjustWindowHeight(event.sender, targetHeight));
|
||||||
ipcMain.handle('toggle-all-windows-visibility', () => windowManager.toggleAllWindowsVisibility());
|
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());
|
// ipcMain.handle('ask:closeAskWindow', () => windowManager.closeAskWindow());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ contextBridge.exposeInMainWorld('api', {
|
|||||||
// src/ui/app/content.html inline scripts
|
// src/ui/app/content.html inline scripts
|
||||||
content: {
|
content: {
|
||||||
// Animation Management
|
// Animation Management
|
||||||
sendAnimationFinished: () => ipcRenderer.send('animation-finished'),
|
// sendAnimationFinished: () => ipcRenderer.send('animation-finished'),
|
||||||
|
|
||||||
// Listeners
|
// Listeners
|
||||||
onSettingsWindowHideAnimation: (callback) => ipcRenderer.on('settings-window-hide-animation', callback),
|
onSettingsWindowHideAnimation: (callback) => ipcRenderer.on('settings-window-hide-animation', callback),
|
||||||
|
@ -98,58 +98,6 @@
|
|||||||
contain: layout style paint;
|
contain: layout style paint;
|
||||||
transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.25s ease-out;
|
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>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -162,27 +110,7 @@
|
|||||||
<script>
|
<script>
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
const app = document.getElementById('pickle-glass');
|
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>
|
||||||
<script>
|
<script>
|
||||||
|
@ -64,6 +64,8 @@ class WindowLayoutManager {
|
|||||||
if (!askVis && !listenVis) return {};
|
if (!askVis && !listenVis) return {};
|
||||||
|
|
||||||
const PAD = 8;
|
const PAD = 8;
|
||||||
|
const headerTopRel = headerBounds.y - workAreaY;
|
||||||
|
const headerBottomRel = headerTopRel + headerBounds.height;
|
||||||
const headerCenterXRel = headerBounds.x - workAreaX + headerBounds.width / 2;
|
const headerCenterXRel = headerBounds.x - workAreaX + headerBounds.width / 2;
|
||||||
|
|
||||||
const relativeX = headerCenterXRel / screenWidth;
|
const relativeX = headerCenterXRel / screenWidth;
|
||||||
@ -87,24 +89,33 @@ class WindowLayoutManager {
|
|||||||
askXRel = screenWidth - PAD - askB.width;
|
askXRel = screenWidth - PAD - askB.width;
|
||||||
listenXRel = askXRel - listenB.width - PAD;
|
listenXRel = askXRel - listenB.width - 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.ask = { x: Math.round(askXRel + workAreaX), y: Math.round(yAbs) };
|
||||||
|
result.listen = { x: Math.round(listenXRel + workAreaX), y: Math.round(yAbs) };
|
||||||
|
}
|
||||||
|
|
||||||
const yPos = (strategy.primary === 'above') ?
|
} else { // 한 창만 보일 때는 기존 로직 유지 (정상 동작 확인)
|
||||||
(headerBounds.y - workAreaY) - Math.max(askB.height, listenB.height) - PAD :
|
|
||||||
(headerBounds.y - workAreaY) + headerBounds.height + 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) };
|
|
||||||
|
|
||||||
} else {
|
|
||||||
const winB = askVis ? askB : listenB;
|
const winB = askVis ? askB : listenB;
|
||||||
let xRel = headerCenterXRel - winB.width / 2;
|
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));
|
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) };
|
const abs = { x: Math.round(xRel + workAreaX), y: Math.round(yPos + workAreaY) };
|
||||||
if (askVis) result.ask = abs;
|
if (askVis) result.ask = abs;
|
||||||
@ -113,37 +124,6 @@ class WindowLayoutManager {
|
|||||||
return result;
|
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() {
|
positionWindows() {
|
||||||
const header = this.windowPool.get('header');
|
const header = this.windowPool.get('header');
|
||||||
if (!header?.getBounds) return;
|
if (!header?.getBounds) return;
|
||||||
@ -201,7 +181,10 @@ class WindowLayoutManager {
|
|||||||
if (!askVisible && !listenVisible) return;
|
if (!askVisible && !listenVisible) return;
|
||||||
|
|
||||||
const PAD = 8;
|
const PAD = 8;
|
||||||
|
const headerTopRel = headerBounds.y - workAreaY;
|
||||||
|
const headerBottomRel = headerTopRel + headerBounds.height;
|
||||||
const headerCenterXRel = headerBounds.x - workAreaX + headerBounds.width / 2;
|
const headerCenterXRel = headerBounds.x - workAreaX + headerBounds.width / 2;
|
||||||
|
|
||||||
let askBounds = askVisible ? ask.getBounds() : null;
|
let askBounds = askVisible ? ask.getBounds() : null;
|
||||||
let listenBounds = listenVisible ? listen.getBounds() : null;
|
let listenBounds = listenVisible ? listen.getBounds() : null;
|
||||||
|
|
||||||
@ -218,22 +201,33 @@ class WindowLayoutManager {
|
|||||||
listenXRel = askXRel - listenBounds.width - PAD;
|
listenXRel = askXRel - listenBounds.width - PAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
const yPos = (strategy.primary === 'above')
|
// [수정] 'above'일 경우 하단 정렬, 'below'일 경우 상단 정렬
|
||||||
? (headerBounds.y - workAreaY) - Math.max(askBounds.height, listenBounds.height) - PAD
|
if (strategy.primary === 'above') {
|
||||||
: (headerBounds.y - workAreaY) + headerBounds.height + PAD;
|
const windowBottomAbs = headerBounds.y - PAD;
|
||||||
const yAbs = yPos + workAreaY;
|
const askY = windowBottomAbs - askBounds.height;
|
||||||
|
const listenY = windowBottomAbs - listenBounds.height;
|
||||||
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(askY), width: askBounds.width, height: askBounds.height });
|
||||||
ask.setBounds({ x: Math.round(askXRel + workAreaX), y: Math.round(yAbs), width: askBounds.width, height: askBounds.height });
|
listen.setBounds({ x: Math.round(listenXRel + workAreaX), y: Math.round(listenY), width: listenBounds.width, height: listenBounds.height });
|
||||||
} else {
|
} else { // 'below'
|
||||||
|
const yPos = headerBottomRel + PAD;
|
||||||
|
const yAbs = yPos + workAreaY;
|
||||||
|
ask.setBounds({ x: Math.round(askXRel + workAreaX), y: Math.round(yAbs), width: askBounds.width, height: askBounds.height });
|
||||||
|
listen.setBounds({ x: Math.round(listenXRel + workAreaX), y: Math.round(yAbs), width: listenBounds.width, height: listenBounds.height });
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // 한 창만 보일 때는 기존 로직 유지 (정상 동작 확인)
|
||||||
const win = askVisible ? ask : listen;
|
const win = askVisible ? ask : listen;
|
||||||
const winBounds = askVisible ? askBounds : listenBounds;
|
const winBounds = askVisible ? askBounds : listenBounds;
|
||||||
let xRel = headerCenterXRel - winBounds.width / 2;
|
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));
|
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;
|
const yAbs = yPos + workAreaY;
|
||||||
|
|
||||||
win.setBounds({ x: Math.round(xRel + workAreaX), y: Math.round(yAbs), width: winBounds.width, height: winBounds.height });
|
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';
|
let currentHeaderState = 'apikey';
|
||||||
const windowPool = new Map();
|
const windowPool = new Map();
|
||||||
let fixedYPosition = 0;
|
|
||||||
|
|
||||||
let settingsHideTimer = null;
|
let settingsHideTimer = null;
|
||||||
|
|
||||||
@ -109,14 +108,18 @@ async function handleWindowVisibilityRequest(windowPool, layoutManager, movement
|
|||||||
movementManager.animateWindow(win, targets.listen.x, targets.listen.y);
|
movementManager.animateWindow(win, targets.listen.x, targets.listen.y);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const targets = layoutManager.getTargetBoundsForListenNextToAsk();
|
const targets = layoutManager.getTargetBoundsForFeatureWindows({ listen: true, ask: true });
|
||||||
if (!targets.listen) return;
|
if (!targets.listen || !targets.ask) return;
|
||||||
|
|
||||||
const startPos = { x: targets.listen.x - ANIM_OFFSET_X, y: targets.listen.y };
|
// 'listen'은 목표 위치의 왼쪽에서 시작
|
||||||
win.setBounds(startPos);
|
const startListenPos = { x: targets.listen.x - ANIM_OFFSET_X, y: targets.listen.y };
|
||||||
|
win.setBounds(startListenPos);
|
||||||
|
|
||||||
|
// 'listen'을 보여주고 두 창을 동시에 애니메이션
|
||||||
win.show();
|
win.show();
|
||||||
win.setOpacity(1);
|
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') {
|
} else if (name === 'ask') {
|
||||||
if (!isOtherWinVisible) {
|
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) => {
|
const setContentProtection = (status) => {
|
||||||
isContentProtectionOn = status;
|
isContentProtectionOn = status;
|
||||||
@ -842,7 +830,6 @@ module.exports = {
|
|||||||
updateLayout,
|
updateLayout,
|
||||||
createWindows,
|
createWindows,
|
||||||
windowPool,
|
windowPool,
|
||||||
fixedYPosition,
|
|
||||||
toggleContentProtection,
|
toggleContentProtection,
|
||||||
resizeHeaderWindow,
|
resizeHeaderWindow,
|
||||||
getContentProtectionStatus,
|
getContentProtectionStatus,
|
||||||
@ -860,5 +847,4 @@ module.exports = {
|
|||||||
moveHeader,
|
moveHeader,
|
||||||
moveHeaderTo,
|
moveHeaderTo,
|
||||||
adjustWindowHeight,
|
adjustWindowHeight,
|
||||||
handleAnimationFinished,
|
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user