Skip to main content

Class: TouchBarScrubber

Class: TouchBarScrubber

Create a scrubber (a scrollable selector)创建一个洗涤器(一个可滚动的选择器)

Process:进程:Main
This class is not exported from the 'electron' module. 此类不是从'electron'模块导出的。It is only available as a return value of other methods in the Electron API.它只能作为Electron API中其他方法的返回值使用。

new TouchBarScrubber(options)

  • options Object
    • items ScrubberItem[] - An array of items to place in this scrubber.要放置在此洗涤器中的一系列项目。
    • select Function (optional) - Called when the user taps an item that was not the last tapped item.当用户点击不是最后一个点击项目的项目时调用。
      • selectedIndex Integer - The index of the item the user selected.用户选择的项目的索引。
    • highlight Function (optional) - Called when the user taps any item.当用户点击任何项目时调用。
      • highlightedIndex Integer - The index of the item the user touched.用户触摸的项目的索引。
    • selectedStyle string (optional) - Selected item style. 所选项目样式。Can be background, outline or none. 可以是backgroundoutlinenoneDefaults to none.默认为none
    • overlayStyle string (optional) - Selected overlay item style. 选定的覆盖项样式。Can be background, outline or none. 可以是backgroundoutlinenoneDefaults to none.默认为none
    • showArrowButtons boolean (optional) - Whether to show arrow buttons. 是否显示箭头按钮。Defaults to false and is only shown if items is non-empty.默认为false,并且仅在items不为空时显示。
    • mode string (optional) - Can be fixed or free. 可以是fixed,也可以是freeThe default is free.默认为free
    • continuous boolean (optional) - Defaults to true.默认为true

Instance Properties实例属性

The following properties are available on instances of TouchBarScrubber:TouchBarScrubber实例上提供了以下属性:

touchBarScrubber.items

A ScrubberItem[] array representing the items in this scrubber. Updating this value immediately updates the control in the touch bar. ScrubberItem[]数组,表示此洗涤器中的项目。更新此值会立即更新触摸条中的控件。Updating deep properties inside this array does not update the touch bar.更新此数组中的深层属性不会更新触摸栏

touchBarScrubber.selectedStyle

A string representing the style that selected items in the scrubber should have. 一个string,表示洗涤器中所选项目应该具有的样式。Updating this value immediately updates the control in the touch bar. 更新此值会立即更新触摸条中的控件。Possible values:可能的值:

  • background - Maps to [NSScrubberSelectionStyle roundedBackgroundStyle].映射到[NSScrubberSelectionStyle roundedBackgroundStyle]
  • outline - Maps to [NSScrubberSelectionStyle outlineOverlayStyle].映射到[NSScrubberSelectionStyle outlineOverlayStyle]
  • none - Removes all styles.删除所有样式。

touchBarScrubber.overlayStyle

A string representing the style that selected items in the scrubber should have. 一个string,表示洗涤器中所选项目应该具有的样式。This style is overlayed on top of the scrubber item instead of being placed behind it. 这种样式覆盖在洗涤器项目的顶部,而不是放在洗涤器项目后面。Updating this value immediately updates the control in the touch bar. 更新此值会立即更新触摸条中的控件。Possible values:可能的值:

  • background - Maps to [NSScrubberSelectionStyle roundedBackgroundStyle].映射到[NSScrubberSelectionStyle roundedBackgroundStyle]
  • outline - Maps to [NSScrubberSelectionStyle outlineOverlayStyle].映射到[NSScrubberSelectionStyle outlineOverlayStyle]
  • none - Removes all styles.删除所有样式。

touchBarScrubber.showArrowButtons

A boolean representing whether to show the left / right selection arrows in this scrubber. 一个boolean,表示是否在此洗涤器中显示左/右选择箭头。Updating this value immediately updates the control in the touch bar.更新此值会立即更新触摸条中的控件。

touchBarScrubber.mode

A string representing the mode of this scrubber. 表示此洗涤器模式的stringUpdating this value immediately updates the control in the touch bar. Possible values:更新此值会立即更新触摸条中的控件。可能的值:

  • fixed - Maps to NSScrubberModeFixed.映射到NSScrubberModeFixed
  • free - Maps to NSScrubberModeFree.映身到NSScrubberModeFree

touchBarScrubber.continuous

A boolean representing whether this scrubber is continuous or not. 一个boolean,表示此洗涤器是否连续。Updating this value immediately updates the control in the touch bar.更新此值会立即更新触摸条中的控件。