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 {
58
58
</ Button >
59
59
< Dropdown . Toggle bsStyle = 'success' />
60
60
< 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 } >
62
65
Add to end (default)
63
66
</ MenuItem >
64
67
{ activePattern . patternStops && activePattern . patternStops . map ( ( stop , i ) => {
68
+ // addIndex is in "reverse" order
65
69
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 ) {
67
72
return null
68
73
}
69
74
// disable adding stop to current position or directly before/after current position
70
75
return (
71
76
< MenuItem
72
- disabled = { index >= addIndex - 2 && index <= addIndex }
77
+ disabled = { index >= addIndex - 2 && index < addIndex }
73
78
value = { addIndex - 1 }
74
79
key = { i }
75
80
eventKey = { addIndex - 1 }
76
81
>
77
- { addIndex === 1 ? 'Add to beginning' : `Insert as stop #${ addIndex } ` }
82
+ { `Insert as stop #${ addIndex } ` }
78
83
</ MenuItem >
79
84
)
80
85
} ) }
86
+ < MenuItem
87
+ disabled = { index === 0 }
88
+ value = { 0 }
89
+ eventKey = { 0 }
90
+ >
91
+ Add to beginning
92
+ </ MenuItem >
81
93
</ Dropdown . Menu >
82
94
</ Dropdown >
83
95
</ ButtonGroup >
You can’t perform that action at this time.
0 commit comments