Merge pull request #9315 from electron/segmented-control-mode

Add mode prop to segmented touch bar control
This commit is contained in:
Kevin Sawicki 2017-05-04 14:16:28 -07:00 committed by GitHub
commit eebae82bc1
3 changed files with 21 additions and 5 deletions

View file

@ -264,16 +264,17 @@ TouchBar.TouchBarSegmentedControl = class TouchBarSegmentedControl extends Touch
constructor (config) {
super()
if (config == null) config = {}
const {segmentStyle, segments, selectedIndex, change} = config
const {segmentStyle, segments, selectedIndex, change, mode} = config
this.type = 'segmented_control'
this._addLiveProperty('segmentStyle', segmentStyle)
this._addLiveProperty('segments', segments || [])
this._addLiveProperty('selectedIndex', selectedIndex)
this._addLiveProperty('mode', mode)
if (typeof change === 'function') {
this.onInteraction = (details) => {
this._selectedIndex = details.selectedIndex
change(details.selectedIndex)
change(details.selectedIndex, details.isSelected)
}
}
}