const findNextGaps = require('../services/find-next-gaps')

module.exports = function paneChanger (state) {
  return ({
    maxAllPanes: function maxAllPanes () {
      state.panes
      .forEach(p => {
        const directions = ['left', 'right', 'up', 'down']
        directions.forEach(d => {
          p.maxSize({[d]: true})
        })
      })
    },
    findGaps: function findGaps () {
      return findNextGaps(state, {x: 0, y: 0})
    }
  })
}

@@ -433,16 +433,584 @@
  y: 0%7D)%0A
+    %7D,%0A    switchPanes: function switchPanes (firstId, secondId) %7B%0A      const firstPane = state.getPane(firstId)%0A      const secondPane = state.getPane(secondId)%0A      const firstLocation = %7B%0A        x: firstPane.x,%0A        y: firstPane.y,%0A        height: firstPane.height,%0A        width: firstPane.width%0A      %7D%0A      const secondLocation = %7B%0A        x: secondPane.x,%0A        y: secondPane.y,%0A        height: secondPane.height,%0A        width: secondPane.width%0A      %7D%0A      firstPane.overrideLocation(secondLocation)%0A      secondPane.overrideLocation(firstLocation)%0A
     %7D%0A  

switch panes