From 21278239fa5e5e5e0451b9665e69b34a739cb70d Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Thu, 26 Apr 2018 06:55:00 -0700 Subject: [PATCH] Fix window graph for generic windowsThis allows generic windows to bring along neighbor windows when sizes change (shade mode doubed etc) --- js/components/App.js | 2 +- js/selectors.js | 13 +++++++++++-- js/utils.js | 6 ++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/js/components/App.js b/js/components/App.js index 4e773308..5ae96674 100644 --- a/js/components/App.js +++ b/js/components/App.js @@ -35,7 +35,7 @@ const App = ({ genWindows.forEach(genWindow => { const { id, title, Component } = genWindow; if (genWindowsInfo[id].open) { - windows[`genWindow${id}`] = ( + windows[id] = ( {({ height, width }) => ( + getWindowPixelSize(genWindow.size) + ); + return { main, equalizer, playlist, ...genWindowSizes }; } export const getWindowGraph = createSelector( diff --git a/js/utils.js b/js/utils.js index 114deda8..78480fb4 100644 --- a/js/utils.js +++ b/js/utils.js @@ -245,3 +245,9 @@ let counter = 0; export function uniqueId() { return counter++; } + +export function objectMap(obj, cb) { + const modified = {}; + Object.keys(obj).forEach(key => (modified[key] = cb(obj[key]))); + return modified; +}