Merge pull request #9315 from electron/segmented-control-mode
Add mode prop to segmented touch bar control
This commit is contained in:
commit
eebae82bc1
3 changed files with 21 additions and 5 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue