Component_button
Ploy3D • Docs
Ploy3D / Component_button
Class: Component_button
UI按钮。
Extends
Constructors
new Component_button()
new Component_button(
system,canvas,id,options):Component_button
构造函数。
Parameters
• system: CalynUI
UI系统实例。
• canvas: Canvas
UI画布实例。
• id: number
实例ID。
• options: object & object & object
可选的初始化数据。
Returns
Overrides
Accessors
active
getactive():boolean
元素是否激活。
setactive(b):void
Parameters
• b: boolean
Returns
boolean
Inherited from
aspect_mode
getaspect_mode():"none"|"width_ctrl"|"height_ctrl"
元素宽高比约束模式。
Returns
"none" | "width_ctrl" | "height_ctrl"
Inherited from
aspect_ratio
getaspect_ratio():number
元素当前宽高比。
Returns
number
Inherited from
children
getchildren():Element[]
子级元素列表。
Returns
Element[]
Inherited from
children_occ_height
getchildren_occ_height():number
文本占用高度。
Returns
number
Overrides
children_occ_width
getchildren_occ_width():number
文本占用宽度。
Returns
number
Overrides
content_size
getcontent_size():object
内容尺寸。
Returns
object
font
font:
string
按钮文本字体。
height
height:
number
内容高度由文本高度决定。
icon_aspect_ratio
icon_aspect_ratio:
number
图标宽高比。
icon_width
icon_width:
number
图标宽度。
text_width
text_width:
number
文本宽度。
width
width:
number
内容宽度。
guid
getguid():string
元素GUID。
Returns
string
Inherited from
height
getheight():object
元素当前设计高度。
Returns
object
height
height:
number
内容区域设计高度。
occ_height
occ_height:
number
总占用设计高度(包含边距)。
timestrap
timestrap:
number
数据时间戳。
Inherited from
id
getid():number
元素ID。
Returns
number
Inherited from
style
getstyle():object
样式设置。
Returns
object
bg_fill?
optionalbg_fill:boolean
是否填充背景。
bg_fill_color?
optionalbg_fill_color:string
背景填充颜色。
bg_radii?
optionalbg_radii:number
圆角矩形圆弧半径。
bg_stroke?
optionalbg_stroke:boolean
是否描绘背景边框。
bg_stroke_color?
optionalbg_stroke_color:string
背景边框颜色。
bg_stroke_dash?
optionalbg_stroke_dash:number
背景边框虚线间隔(实线长度为间隔的2倍)。
bg_stroke_width?
optionalbg_stroke_width:number
背景边框线宽。
font?
optionalfont:string
字体。
font_color?
optionalfont_color:string
字体颜色。
font_size?
optionalfont_size:number
字体大小(单位PX)。
Inherited from
text
settext(value):void
设置按钮文本。
Parameters
• value: string
type
gettype():"canvas"|"layout"|"panel"|"component"
元素类型("layout","canvas"都派生自"panel",所以可以认为只有两大类"component","panel")。
Returns
"canvas" | "layout" | "panel" | "component"
Inherited from
width
getwidth():object
元素当前设计宽度。
Returns
object
occ_width
occ_width:
number
总占用设计宽度(包含边距)。
timestrap
timestrap:
number
数据时间戳。
width
width:
number
内容区域设计宽度。
Inherited from
Methods
AddChild()
AddChild<
T>(option):T
添加子级元素。
Type Parameters
• T extends Element
Parameters
• option: Options
子级元素配置。
Returns
T
Inherited from
Draw()
Draw(
pass,style):Promise<void>
绘制元素(派生类应当重写该方法)。
Parameters
• pass: number
绘制阶段。
• style
• style.bg_fill?: boolean
是否填充背景。
• style.bg_fill_color?: string
背景填充颜色。
• style.bg_radii?: number
圆角矩形圆弧半径。
• style.bg_stroke?: boolean
是否描绘背景边框。
• style.bg_stroke_color?: string
背景边框颜色。
• style.bg_stroke_dash?: number
背景边框虚线间隔(实线长度为间隔的2倍)。
• style.bg_stroke_width?: number
背景边框线宽。
• style.font?: string
字体。
• style.font_color?: string
字体颜色。
• style.font_size?: number
字体大小(单位PX)。
Returns
Promise<void>
Inherited from
OnDrag()
OnDrag(
width,height,event):void
拖拽元素。
Parameters
• width: number
拖拽实际所在平面宽度。
• height: number
拖拽实际所在平面高度。
• event: MouseEvent & object
鼠标事件对象。