Initial NSScrubber implementation

This commit is contained in:
Samuel Attard 2017-03-13 10:51:12 +11:00
parent 280337bf46
commit 25a231fc50
No known key found for this signature in database
GPG key ID: E89DDE5742D58C4E
6 changed files with 178 additions and 2 deletions

View file

@ -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