Browse Source

Fix mini player resizing bugs

reviewable/pr190/r10
Samuel Attard 6 years ago
parent
commit
1a33c1237c
  1. 12
      src/main/features/core/persistAppState.js

12
src/main/features/core/persistAppState.js

@ -6,19 +6,29 @@ Emitter.on('mini', (event, state) => {
mini = state.state;
});
let resizeTimer;
const _save = () => {
if (!mini) {
Settings.set('position', mainWindow.getPosition());
Settings.set('size', mainWindow.getSize());
} else {
const dimension = Math.max(...mainWindow.getSize());
mainWindow.setSize(dimension, dimension);
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(() => mainWindow.setSize(dimension, dimension), 100);
Emitter.sendToGooglePlayMusic('set:zoom', dimension / 310);
}
};
mainWindow.on('move', _save);
mainWindow.on('resize', _save);
mainWindow.on('maximize', (ev) => {
if (mini) {
mainWindow.unmaximize();
ev.preventDefault();
return false;
}
});
Emitter.on('eq:change', (event, details) => {
const eq = Settings.get('eq', [1, 1, 1, 1, 1, 1]);

Loading…
Cancel
Save