Interface for Scroller component.

Scroller 组件接口。

实现

构造函数

访问器

  • get barDisplay(): ScrollBarDisplay
  • 返回 ScrollBarDisplay

    The display mode of the scroll bar. The global default value can be set through UIConfig2.defaultScrollBarDisplay.

    滚动条的显示模式。全局的默认值可以通过UIConfig2.defaultScrollBarDisplay设置。

  • set barDisplay(value): void
  • 参数

    返回 void

    The display mode of the scroll bar. The global default value can be set through UIConfig2.defaultScrollBarDisplay.

    滚动条的显示模式。全局的默认值可以通过UIConfig2.defaultScrollBarDisplay设置。

  • get barFloating(): boolean
  • 返回 boolean

    Whether the scroll bar is floating. Floating scroll bars do not occupy viewport space.

    滚动条是否浮动。浮动的滚动条不占用视口空间。

  • set barFloating(value): void
  • 参数

    • value: boolean

    返回 void

    Whether the scroll bar is floating. Floating scroll bars do not occupy viewport space.

    滚动条是否浮动。浮动的滚动条不占用视口空间。

  • get barMargin(): number[]
  • 返回 number[]

    The margin around the scroll bar.

    滚动条周围的边距。

  • set barMargin(value): void
  • 参数

    • value: number[]

    返回 void

    The margin around the scroll bar.

    滚动条周围的边距。

  • get barOnLeft(): boolean
  • 返回 boolean

    Whether the scroll bar is on the left side.

    滚动条是否在左侧。

  • set barOnLeft(value): void
  • 参数

    • value: boolean

    返回 void

    Whether the scroll bar is on the left side.

    滚动条是否在左侧。

  • get bouncebackEffect(): ScrollBounceBackEffect
  • 返回 ScrollBounceBackEffect

    The bounce back effect of the scroller. Default value can be set globally through UIConfig2.defaultScrollBounceEffect.

    Scroller 的回弹效果。全局的默认值可以通过UIConfig2.defaultScrollBounceEffect设置。

  • set bouncebackEffect(value): void
  • 返回 void

    The bounce back effect of the scroller. Default value can be set globally through UIConfig2.defaultScrollBounceEffect.

    Scroller 的回弹效果。全局的默认值可以通过UIConfig2.defaultScrollBounceEffect设置。

  • get contentHeight(): number
  • 返回 number

    The height of the content area.

    Scroller 内容区域的高度。

  • get contentWidth(): number
  • 返回 number

    The width of the content area.

    Scroller 内容区域的宽度。

  • get decelerationRate(): number
  • 返回 number

    The deceleration rate of the scroller. The global default value can be set through UIConfig2.defaultScrollDecelerationRate.

    Scroller 的减速率。全局的默认值可以通过UIConfig2.defaultScrollDecelerationRate设置。

  • set decelerationRate(value): void
  • 参数

    • value: number

    返回 void

    The deceleration rate of the scroller. The global default value can be set through UIConfig2.defaultScrollDecelerationRate.

    Scroller 的减速率。全局的默认值可以通过UIConfig2.defaultScrollDecelerationRate设置。

  • get inertiaDisabled(): boolean
  • 返回 boolean

    Whether to disable inertia scrolling.

    是否禁用惯性滚动。

  • set inertiaDisabled(value): void
  • 参数

    • value: boolean

    返回 void

    Whether to disable inertia scrolling.

    是否禁用惯性滚动。

  • get isBottomMost(): boolean
  • 返回 boolean

    Whether the scrolling has reached the bottom-most position.

    是否已滚动到最底。

  • get isDragged(): boolean
  • 返回 boolean

    Returns true if the scroller is being dragged, otherwise false.

    Whether the scroller is currently being dragged.

    Scroller 是否正在被拖动。

  • get isRightMost(): boolean
  • 返回 boolean

    Whether the scrolling has reached the right-most position.

    是否已滚动到最右侧。

  • get mouseWheelDisabled(): boolean
  • 返回 boolean

    Whether to disable mouse wheel scrolling.

    禁用鼠标滚轮滚动。

  • set mouseWheelDisabled(value): void
  • 参数

    • value: boolean

    返回 void

    Whether to disable mouse wheel scrolling.

    禁用鼠标滚轮滚动。

  • get paddingMaskDisabled(): boolean
  • 返回 boolean

    Whether to disable padding mask. Generally, the viewport does not include the padding area set around it, meaning that the empty space around the container will also be clipped. If needed, this option can be checked to prevent clipping of the empty space around the container.

    禁用裁剪边缘。一般情况下,视口不包括边缘设置的部分,也即是容器设置四周的留空部分也会被裁剪。如果需要,可以勾选这个选项,使容器四周的留空部分不被裁剪。

  • set paddingMaskDisabled(value): void
  • 参数

    • value: boolean

    返回 void

    Whether to disable padding mask. Generally, the viewport does not include the padding area set around it, meaning that the empty space around the container will also be clipped. If needed, this option can be checked to prevent clipping of the empty space around the container.

    禁用裁剪边缘。一般情况下,视口不包括边缘设置的部分,也即是容器设置四周的留空部分也会被裁剪。如果需要,可以勾选这个选项,使容器四周的留空部分不被裁剪。

  • get pageCountX(): number
  • 返回 number

    The number of pages in the x-direction.

    Scroller 在水平方向上的页数。

  • get pageCountY(): number
  • 返回 number

    The number of pages in the y-direction.

    Scroller 在垂直方向上的页数。

  • get pageMode(): boolean
  • 返回 boolean

    Whether the scroller is in page mode.

    Scroller 是否处于分页模式。

  • set pageMode(value): void
  • 参数

    • value: boolean

    返回 void

    Whether the scroller is in page mode.

    Scroller 是否处于分页模式。

  • get pageX(): number
  • 返回 number

    If the scroller is in page mode, returns the index of the current page in the x-direction.

    如果 Scroller 处于分页模式,则返回水平方向上当前页的索引。

  • set pageX(value): void
  • 参数

    • value: number

    返回 void

    If the scroller is in page mode, returns the index of the current page in the x-direction.

    如果 Scroller 处于分页模式,则返回水平方向上当前页的索引。

  • get pageY(): number
  • 返回 number

    If the scroller is in page mode, sets the index of the current page in the y-direction.

    如果 Scroller 处于分页模式,则设置垂直方向上当前页的索引。

  • set pageY(value): void
  • 参数

    • value: number

    返回 void

    If the scroller is in page mode, sets the index of the current page in the y-direction.

    如果 Scroller 处于分页模式,则设置垂直方向上当前页的索引。

  • get percX(): number
  • 返回 number

    The percentage of the scroller's position in the x-direction. The value ranges from 0 to 1.

    Scroller 在 x 方向上的位置百分比。值范围是0到1。

  • set percX(value): void
  • 参数

    • value: number

    返回 void

    The percentage of the scroller's position in the x-direction. The value ranges from 0 to 1.

    Scroller 在 x 方向上的位置百分比。值范围是0到1。

  • get percY(): number
  • 返回 number

    The percentage of the scroller's position in the y-direction. The value ranges from 0 to 1.

    Scroller 在 y 方向上的位置百分比。值范围是0到1。

  • set percY(value): void
  • 参数

    • value: number

    返回 void

    The percentage of the scroller's position in the y-direction. The value ranges from 0 to 1.

    Scroller 在 y 方向上的位置百分比。值范围是0到1。

  • get posX(): number
  • 返回 number

    The x-coordinate of the top-left corner of the scroller's content.

    Scroller 内容的左上角 x 坐标。

  • set posX(value): void
  • 参数

    • value: number

    返回 void

    The x-coordinate of the top-left corner of the scroller's content.

    Scroller 内容的左上角 x 坐标。

  • get posY(): number
  • 返回 number

    The y-coordinate of the top-left corner of the scroller's content.

    Scroller 内容的左上角 y 坐标。

  • set posY(value): void
  • 参数

    • value: number

    返回 void

    The y-coordinate of the top-left corner of the scroller's content.

    Scroller 内容的左上角 y 坐标。

  • get scrollingPosX(): number
  • 返回 number

    When no bounce occurs, the value is the same as posX; when a bounce occurs, posX is constrained between 0 and overlapSize.x, while scrollingPosX returns the actual position value.

    当没有发生回弹时,返回值和posX一致;当发生回弹时,posX会被限制在0和overlapSize.x之间,而scrollingPosX会返回真实的位置值。

  • get scrollingPosY(): number
  • 返回 number

    When no bounce occurs, the value is the same as posY; when a bounce occurs, posY is constrained between 0 and overlapSize.y, while scrollingPosY returns the actual position value.

    当没有发生回弹时,返回值和posY一致;当发生回弹时,posY会被限制在0和overlapSize.y之间,而scrollingPosY会返回真实的位置值。

  • get snapToItem(): boolean
  • 返回 boolean

    Whether to snap to the nearest item when scrolling.

    滚动时是否对齐到最近的项。

  • set snapToItem(value): void
  • 参数

    • value: boolean

    返回 void

    Whether to snap to the nearest item when scrolling.

    滚动时是否对齐到最近的项。

  • get step(): number
  • 返回 number

    The step size for scrolling when using the mouse wheel. The global default value can be set through UIConfig2.defaultScrollStep.

    当使用鼠标滚轮滚动时,每次滚动的距离。全局的默认值可以通过UIConfig2.defaultScrollStep设置。

  • set step(value): void
  • 参数

    • value: number

    返回 void

    The step size for scrolling when using the mouse wheel. The global default value can be set through UIConfig2.defaultScrollStep.

    当使用鼠标滚轮滚动时,每次滚动的距离。全局的默认值可以通过UIConfig2.defaultScrollStep设置。

  • get touchEffect(): ScrollTouchEffect
  • 返回 ScrollTouchEffect

    The touch effect of the scroller. Default value can be set globally through UIConfig2.defaultScrollTouchEffect.

    Scroller 的触摸效果。全局的默认值可以通过UIConfig2.defaultScrollTouchEffect设置。

  • set touchEffect(value): void
  • 参数

    返回 void

    The touch effect of the scroller. Default value can be set globally through UIConfig2.defaultScrollTouchEffect.

    Scroller 的触摸效果。全局的默认值可以通过UIConfig2.defaultScrollTouchEffect设置。

  • get touchEffectButton(): number
  • 返回 number

    The touch effect for buttons in the scroller. Default value can be set globally through UIConfig2.touchEffectButton.

    用于触摸拖动的鼠标按键,开启了touchEffect后有效。 0-左键,1-中键,2-右键。

  • set touchEffectButton(value): void
  • 参数

    • value: number

    返回 void

    The touch effect for buttons in the scroller. Default value can be set globally through UIConfig2.touchEffectButton.

    用于触摸拖动的鼠标按键,开启了touchEffect后有效。 0-左键,1-中键,2-右键。

方法

  • 返回 number

    Returns the index of the first child widget in view, or -1 if no child is in view.

    Gets the index of the first child widget that is currently in view.

    获取当前在视图中的第一个子部件的索引。

  • 参数

    • obj: GWidget

      The child widget to check.

    返回 boolean

    Returns true if the child widget is in view, otherwise false.

    Checks if a specific child widget is currently in view.

    检查指定的子部件是否在视图中。

  • 参数

    • size: number

      The size of the footer.

    返回 void

    Locks the footer widget, keeping it visible and fixed at the bottom during scrolling.

    锁定页尾部件,即使其显示,并在滚动时保持在底部。

  • 参数

    • size: number

      The size of the header.

    返回 void

    Locks the header widget, keeping it visible and fixed at the top during scrolling.

    锁定页头部件,即使其显示,并在滚动时保持在顶部。

  • 参数

    • 可选ratio: number

      The ratio of the step size, ranging from 0 to 1, with a default value of 1. The base is the value of the step property , and if in page mode, the base is the height of the page.

    • 可选ani: boolean

      Whether to use an animated transition, default is false.

    返回 void

    Scrolls down once, with the step size controlled by the ratio parameter.

    向下滚动一次,步长由ratio参数控制。

  • 参数

    • 可选ratio: number

      The ratio of the step size, ranging from 0 to 1, with a default value of 1. The base is the value of the step property, and if in page mode, the base is the width of the page.

    • 可选ani: boolean

      Whether to use an animated transition, default is false.

    返回 void

    Scrolls to the left once, with the step size controlled by the ratio parameter.

    向左滚动一次,步长由ratio参数控制。

  • 参数

    • 可选ratio: number

      The ratio of the step size, ranging from 0 to 1, with a default value of 1. The base is the value of the step property, and if in page mode, the base is the width of the page.

    • 可选ani: boolean

      Whether to use an animated transition, default is false.

    返回 void

    Scrolls to the right once, with the step size controlled by the ratio parameter.

    向右滚动一次,步长由ratio参数控制。

  • 参数

    • target: GWidget

      The target widget to scroll to.

    • 可选ani: boolean

      Whether to animate the scroll action, default is false.

    • 可选setFirst: boolean

      If true, sets the target as the first child in view.

    返回 void

    Scrolls to a specific target widget, with an option to animate the scroll action.

    滚动到指定的目标部件,可以选择是否使用动画过渡。

  • 参数

    • target: GWidget

      The target rectangle to scroll to.

    • 可选ani: boolean

      Whether to animate the scroll action, default is false.

    • 可选secondTarget: GWidget

      If not null, sets it as the first child in view.

    返回 void

    Scrolls to a specific target rectangle, with an option to animate the scroll action.

    滚动到指定的目标矩形,可以选择是否使用动画过渡。

  • 参数

    • rect: Rectangle
    • 可选ani: boolean

      Whether to animate the scroll action, default is false.

    • 可选setFirst: boolean

      If true, sets the target as the first child in view.

    返回 void

    Scrolls to a specific target rectangle, with an option to animate the scroll action.

    滚动到指定的目标矩形,可以选择是否使用动画过渡。

  • 参数

    • childIndex: number
    • 可选ani: boolean

      Whether to animate the scroll action, default is false.

    • 可选setFirst: boolean

      If true, sets the target as the first child in view.

    返回 void

    Scrolls to a child with specific index, with an option to animate the scroll action.

    滚动到指定索引的子项,可以选择是否使用动画过渡。

  • 参数

    • 可选ratio: number

      The ratio of the step size, ranging from 0 to 1, with a default value of 1. The base is the value of the step property, and if in page mode, the base is the height of the page.

    • 可选ani: boolean

      Whether to use an animated transition, default is false.

    返回 void

    Scrolls up once, with the step size controlled by the ratio parameter.

    向上滚动一次,步长由ratio参数控制。

  • 参数

    • value: number

      The percentage value, ranging from 0 to 1.

    • 可选ani: boolean

      Whether to animate the change.

    返回 void

    Sets the percentage of the scroller's position in the x-direction.

    设置 Scroller 在 x 方向上的位置百分比。

  • 参数

    • value: number

      The percentage value, ranging from 0 to 1.

    • 可选ani: boolean

      Whether to animate the change.

    返回 void

    Sets the percentage of the scroller's position in the y-direction.

    设置 Scroller 在 y 方向上的位置百分比。

  • 参数

    • value: number

      The x-coordinate value.

    • 可选ani: boolean

      Whether to animate the change.

    返回 void

    Sets the x-coordinate of the top-left corner of the scroller's content.

    设置 Scroller 内容的左上角 x 坐标。

  • 参数

    • value: number

      The y-coordinate value.

    • 可选ani: boolean

      Whether to animate the change.

    返回 void

    Sets the y-coordinate of the top-left corner of the scroller's content.

    设置 Scroller 内容的左上角 y 坐标。