File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
lib/editor/components/map Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -58,26 +58,38 @@ export default class PatternStopPopup extends Component {
5858 </ Button >
5959 < Dropdown . Toggle bsStyle = 'success' />
6060 < Dropdown . Menu style = { { maxHeight : '200px' , overflowY : 'scroll' } } >
61- < MenuItem disabled = { index >= activePattern . patternStops . length - 2 } value = { activePattern . patternStops . length } eventKey = { activePattern . patternStops . length } >
61+ < MenuItem
62+ disabled = { index >= activePattern . patternStops . length - 1 }
63+ value = { activePattern . patternStops . length }
64+ eventKey = { activePattern . patternStops . length } >
6265 Add to end (default)
6366 </ MenuItem >
6467 { activePattern . patternStops && activePattern . patternStops . map ( ( stop , i ) => {
68+ // addIndex is in "reverse" order
6569 const addIndex = activePattern . patternStops . length - i
66- if ( index === activePattern . patternStops . length - 1 && index === addIndex - 1 ) {
70+ // skip MenuItem index is the same as the pattern stop index
71+ if ( index === addIndex - 1 ) {
6772 return null
6873 }
6974 // disable adding stop to current position or directly before/after current position
7075 return (
7176 < MenuItem
72- disabled = { index >= addIndex - 2 && index <= addIndex }
77+ disabled = { index >= addIndex - 2 && index < addIndex }
7378 value = { addIndex - 1 }
7479 key = { i }
7580 eventKey = { addIndex - 1 }
7681 >
77- { addIndex === 1 ? 'Add to beginning' : `Insert as stop #${ addIndex } ` }
82+ { `Insert as stop #${ addIndex } ` }
7883 </ MenuItem >
7984 )
8085 } ) }
86+ < MenuItem
87+ disabled = { index === 0 }
88+ value = { 0 }
89+ eventKey = { 0 }
90+ >
91+ Add to beginning
92+ </ MenuItem >
8193 </ Dropdown . Menu >
8294 </ Dropdown >
8395 </ ButtonGroup >
You can’t perform that action at this time.
0 commit comments