Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8971 from cezaraugusto/tabsbar/8909
Browse files Browse the repository at this point in the history
make number of tabs match max tabs per page
  • Loading branch information
bbondy committed May 20, 2017
1 parent cbaee97 commit 0067c4f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/state/frameStateUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ function getFrameKeysByDisplayIndex (state) {
}, [])
}

function getFrameKeysByNonPinnedDisplayIndex (state) {
return state.get('frames')
.filter((frame) => !frame.get('pinnedLocation'))
.map((frame) => frame.get('key'))
}

/**
* Obtains the display index for the specified frame key excluding pins
*/
function findNonPinnedDisplayIndexForFrameKey (state, key) {
return getFrameKeysByNonPinnedDisplayIndex(state)
.findIndex((displayKey) => displayKey === key)
}

function getFrameByDisplayIndex (state, i) {
let frames = getFrameKeysByDisplayIndex(state)
let key = frames[i]
Expand Down Expand Up @@ -460,7 +474,7 @@ function removeFrame (state, frameProps, activeFrameKey, framePropsIndex, closeA

function getFrameTabPageIndex (state, frameProps, tabsPerTabPage) {
frameProps = makeImmutable(frameProps)
const index = getFrameIndex(state, frameProps.get('key'))
const index = findNonPinnedDisplayIndexForFrameKey(state, frameProps.get('key'))
if (index === -1) {
return -1
}
Expand Down

0 comments on commit 0067c4f

Please sign in to comment.