Skip to content
ScrollBox

界面 / ScrollBox

ScrollBox Class

滑动框

Hierarchy

Table of contents

Properties

click

Properties

onCustomPropertyChange: Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>> client
监听自定义属性同步事件

Accessors

allowOverscroll(isAllowOverscroll: boolean): void client
设置允许滚动超过滚动框大小
alwaysShowScrollBar(): boolean client
获取是否一直显示滚动条
animationType(): UIScrollBoxAnimationType client
获取动画类型
defaultLocation(): ScrollBarDefaultLocation client
返回滚动条的默认位置(类型,非具体坐标)
elasticMultiplier(): number client
获取弹性系数
onScrollEnd(): MulticastDelegate<() => void> client
滚动结束事件
onUserScrolled(): MulticastDelegate<(currentOffset: number) => void> client
滚动事件
orientation(): Orientation client
获取滚动方向
scrollAxisBrushDrawType(): Readonly<SlateBrushDrawType> client
获取滚动条图片绘制类型
scrollAxisBrushGuid(): string client
获取滚动条图片ID
scrollAxisBrushMargin(): Readonly<Margin> client
获取滚动条图片边距
scrollAxisColor(): Readonly<LinearColor> client
获取滚动条图片颜色
scrollBarVisibility(): SlateVisibility client
获取滚动条的显示于隐藏
scrollOffset(): number client
获取滚动框偏移
scrollOffsetFraction(): number client
获取滚动框距离底部的偏移比例
scrollOffsetOfEnd(): number client
获取滚动框距离底部的偏移
scrollWheelMultiplier(inScrollWheelMultiplier: number): void client
设置鼠标滚轮系数
scrollbarPadding(inScrollbarPadding: Margin): void client
设置滚动条边距
scrollbarThickness(): number client
获取滚动条粗细
shadowVisibility(): SlateVisibility client
获取阴影显示
smoothScrollingEnable(isSmoothScrolling: boolean): void client
设定鼠标滚动时,滚动速度是否插值运算,限制滚动速度更平滑
supportElastic(): boolean client
判断是否支持惯性
click

Accessors

alignPosition(): Readonly<Vector2> client
获取控件的对齐位置,在对齐方式为靠右对齐、靠下对齐、中心对齐时,alignPosition的值与positon不同;
autoSizeHorizontalEnable(): boolean client
获取是否自动水平设置大小
autoSizeVerticalEnable(): boolean client
获取是否自动垂直设置大小
cachedGeometry(): Geometry client
获取上一次的GetTickSpaceGeometry
constraints(): Readonly<UIConstraintAnchors> client
获取控件的布局
desiredSize(): Vector2 client
获取期望大小
enable(): boolean client
是否可用
guid(): string client
获取控件GUID
isHovered(): boolean client
是否是hovered
mouseCursor(): MouseCursor client
获取控件上光标类型
name(): string client
获取名字
paintSpaceGeometry(): Geometry client
获取最后一次用于渲染Widget的几何信息
parent(): Widget client
获取父节点
pivot(): Vector2 client
获取控件锚点位置,这个属性决定了控件图形与锚点的相对位置;(0,0)时,锚点位于控件左上角;(0.5,0.5)时,锚点位于控件正中心
position(): Readonly<Vector2> client
获取控件的位置
renderOpacity(): number client
获取渲染透明度
renderScale(): Vector2 client
获取渲染缩放
renderShear(): Vector2 client
获取渲染错切形变
renderTransformAngle(): number client
获取渲染的角度
renderTransformPivot(): Vector2 client
获取渲染锚点
size(): Vector2 client
获取大小
tickSpaceGeometry(): Geometry client
获取最后一次用于驱动Widget Tick的几何信息
transform(): Readonly<UITransform> client
得到控件的大小和位置
visibility(): SlateVisibility client
获取可见性
visible(): boolean client
是否可见
zOrder(): number client
获取zorder

Methods

endInertialScrolling(): void client
立刻停止滚动
scrollToEnd(): void client
滚动到底部
scrollToStart(): void client
滚动到开始位置
newObject(parent?: Canvas, inName?: string): ScrollBox client
创建 ScrollBox 控件
click

Methods

addChild(child: Widget): void client
添加子节点
clone(position: Vector2, Parent?: Widget): Widget client
克隆UI控件及其子节点到指定父控件位置(默认到其父节点)
destroyObject(): void client
立刻移除并销毁 不可以在使用
equal(that: Widget): boolean client
判断是不是同一个对象
findChildByPath(inPath: string): Widget client
通过相对路径查找节点
getChildAt(index: number): Widget client
获取第几位子节点
getChildByName<T: extends Widget<T>>(name: string): T: extends Widget<T> client
通过名字查找节点
getChildrenCount(): number client
获取子节点数量
getCustomProperties(): string[] client
获取所有自定义属性
getCustomProperty<T: extends CustomPropertyType>(propertyName: string): T: extends CustomPropertyType client
获取自定义属性
getCustomPropertyChangeDelegate(property): Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>> client
给定对象属性修改时触发的事件代理
invalidateLayoutAndVolatility(): void client
立刻触发重新渲染的和排布计算
removeAllChildren(): void client
清除所有子节点,会销毁UI无法再使用
removeChild(child: Widget): void client
移除节点,会销毁UI无法在使用
removeChildAt(index: number): void client
移除第几个节点,会销毁UI无法再使用
removeObject(): void client
立刻移除并添加到根节点 可以再使用
serialize(): string client
序列化UI控件
setCustomProperty(propertyName: string, value: undefined CustomPropertyType): void client
设置自定义属性
deserialize(Data: string, Parent?: Widget): Widget client
反序列化UI

Properties

Accessors


allowOverscroll

set allowOverscroll(isAllowOverscroll): void client

设置允许滚动超过滚动框大小

Parameters

isAllowOverscroll boolean允许滚动超过滚动框大小

alwaysShowScrollBar

get alwaysShowScrollBar(): boolean client

set alwaysShowScrollBar(isScrollBarAlwaysShown): void client

获取是否一直显示滚动条

Returns

boolean是否一直显示滚动条

设置是否一直显示滚动条

Parameters

isScrollBarAlwaysShown boolean是否一直显示滚动条

animationType

get animationType(): UIScrollBoxAnimationType client

set animationType(inAnimationType): void client

获取动画类型

Returns

UIScrollBoxAnimationType动画类型

设定动画类型

Parameters

inAnimationType UIScrollBoxAnimationType类型

动画类型


defaultLocation

get defaultLocation(): ScrollBarDefaultLocation client

set defaultLocation(NewDefaultLocation): void client

返回滚动条的默认位置(类型,非具体坐标)

Precautions

没有操作滚动条的情况下滚动条的默认位置

Returns

ScrollBarDefaultLocation返回滚动条的默认位置(类型,非具体坐标)

设置滚动条的默认位置(类型,非具体坐标)

Precautions

没有操作滚动条的情况下滚动条的默认位置

Parameters

NewDefaultLocation ScrollBarDefaultLocation滚动条默认位置(类型,非具体坐标)

elasticMultiplier

get elasticMultiplier(): number client

set elasticMultiplier(inElasticMultiplier): void client

获取弹性系数

Returns

number弹性系数

设定弹性系数

Parameters

inElasticMultiplier number系数

弹性系数


onScrollEnd

get onScrollEnd(): MulticastDelegate<() => void> client

滚动结束事件

Returns

MulticastDelegate<() => void>滚动结束事件

onUserScrolled

get onUserScrolled(): MulticastDelegate<(currentOffset: number) => void> client

滚动事件

Returns

MulticastDelegate<(currentOffset: number) => void>滚动事件

orientation

get orientation(): Orientation client

set orientation(inOrientation): void client

获取滚动方向

Returns

Orientation滚动方向

设置滚动方向

Parameters

inOrientation Orientation方向

滚动方向


scrollAxisBrushDrawType

get scrollAxisBrushDrawType(): Readonly<SlateBrushDrawType> client

set scrollAxisBrushDrawType(InDrawAs): void client

获取滚动条图片绘制类型

Returns

Readonly<SlateBrushDrawType>图片绘制类型

设置图片绘制类型

Parameters

InDrawAs SlateBrushDrawType图片绘制类型

scrollAxisBrushGuid

get scrollAxisBrushGuid(): string client

set scrollAxisBrushGuid(InGUID): void client

获取滚动条图片ID

Returns

string滚动条图片ID

设置滚动条图片ID

Parameters

InGUID string图片ID

scrollAxisBrushMargin

get scrollAxisBrushMargin(): Readonly<Margin> client

set scrollAxisBrushMargin(InMargin): void client

获取滚动条图片边距

Returns

Readonly<Margin>滚动条图片边距

设置滚动条图片边距

Parameters

InMargin Margin滚动条图片边距

scrollAxisColor

get scrollAxisColor(): Readonly<LinearColor> client

set scrollAxisColor(InColor): void client

获取滚动条图片颜色

Returns

Readonly<LinearColor>滚动条图片颜色,Type.LinearColor类型,数据范围0~1

设置滚动条图片颜色

Parameters

InColor LinearColor滚动条图片颜色,Type.LinearColor类型,数据范围0~1

scrollBarVisibility

get scrollBarVisibility(): SlateVisibility client

set scrollBarVisibility(inScrollBarVisibility): void client

获取滚动条的显示于隐藏

Returns

SlateVisibility滚动条的显示于隐藏

设置滚动条是否可见,必须是在SetAlwaysShowScrollbar 为false才生效

Parameters

inScrollBarVisibility SlateVisibility滚动条是否可见

scrollOffset

get scrollOffset(): number client

set scrollOffset(inScrollOffset): void client

获取滚动框偏移

Returns

number滚动框偏移

设定滚动框滚动偏移

Parameters

inScrollOffset number滚动偏移

scrollOffsetFraction

get scrollOffsetFraction(): number client

获取滚动框距离底部的偏移比例

Returns

number滚动框偏移比例

scrollOffsetOfEnd

get scrollOffsetOfEnd(): number client

获取滚动框距离底部的偏移

Returns

number滚动框偏移

scrollWheelMultiplier

set scrollWheelMultiplier(inScrollWheelMultiplier): void client

设置鼠标滚轮系数

Parameters

inScrollWheelMultiplier number系数

鼠标滚轮系数


scrollbarPadding

set scrollbarPadding(inScrollbarPadding): void client

设置滚动条边距

Parameters

inScrollbarPadding Margin滚动条边距

scrollbarThickness

get scrollbarThickness(): number client

set scrollbarThickness(inScrollbarThickness): void client

获取滚动条粗细

Returns

number滚动条粗细

设置滚动条粗细

Parameters

inScrollbarThickness number滚动条粗细

shadowVisibility

get shadowVisibility(): SlateVisibility client

set shadowVisibility(inVisibility): void client

获取阴影显示

Returns

SlateVisibility阴影显示

设定阴影显示

Parameters

inVisibility SlateVisibility阴影显示

阴影显示


smoothScrollingEnable

set smoothScrollingEnable(isSmoothScrolling): void client

设定鼠标滚动时,滚动速度是否插值运算,限制滚动速度更平滑

Parameters

isSmoothScrolling boolean鼠标滚动时,滚动速度是否插值运算

supportElastic

get supportElastic(): boolean client

set supportElastic(inSupportElastic): void client

判断是否支持惯性

Returns

boolean是否支持惯性

设定是否支持惯性

Parameters

inSupportElastic boolean惯性

是否支持惯性

Methods


endInertialScrolling

endInertialScrolling(): void client

立刻停止滚动


scrollToEnd

scrollToEnd(): void client

滚动到底部


scrollToStart

scrollToStart(): void client

滚动到开始位置


newObject

Static newObject(parent?, inName?): ScrollBox client

创建 ScrollBox 控件

Parameters

parent? Canvas创建控件的外parent对象 default:null
inName? string创建控件的名称 default:null range:设置合理的名称即可

Returns

ScrollBox创建的对象

当parent和inName与已有的对象相同时,旧的对象会被销毁