Initial NSScrubber implementation
This commit is contained in:
parent
280337bf46
commit
25a231fc50
6 changed files with 178 additions and 2 deletions
|
@ -231,4 +231,24 @@ TouchBar.TouchBarSegmentedControl = class TouchBarSegmentedControl extends Touch
|
|||
}
|
||||
}
|
||||
|
||||
TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem {
|
||||
constructor(config) {
|
||||
super()
|
||||
if (config == null) config = {}
|
||||
const {items, onSelect, onHighlight} = config
|
||||
this.type = 'scrubber'
|
||||
this._addLiveProperty('items', items)
|
||||
|
||||
if (typeof onSelect === 'function' || typeof onHighlight === 'function') {
|
||||
this.onInteraction = (details) => {
|
||||
if (details.type === 'select') {
|
||||
onSelect(details.selectedIndex);
|
||||
} else if (details.type === 'highlight') {
|
||||
onHighlight(details.highlightedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TouchBar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue