new Component(comp, data, view)
Parameters:
Name | Type | Description |
---|---|---|
comp |
any | |
data |
ht.Data | |
view |
ht.graph.GraphView | ht.graph3d.Graph3dView |
Members
-
_innerPrefix :string
-
-
_transitionFrame :ht.drawing.TimeFrame
-
-
_transitionMap :any
-
-
_transitionParams :Array.<string>
-
需要记录过渡的属性
-
clip :boolean
-
是否对组件内容裁切,需要可以在构造函数设置为 true
-
comp :Object
-
-
data :any
-
-
drawInfo :ht.drawing.DrawInfo
-
-
params :any
-
-
rawParams :any
-
-
rect :Rect
-
原始的属性值,过渡的属性原始值会被存在这里
-
transition :ht.drawing.Transition
-
-
view :any
-
Methods
-
addEventListener(func) → {void}
-
Parameters:
Name Type Description func
function Returns:
void -
clearTransition() → {void}
-
Returns:
void -
clipRect(g, rect, radius) → {void}
-
对指定区域裁切,需要自行进行 restore
Parameters:
Name Type Attributes Description g
CanvasRenderingContext2D rect
Rect radius
Array.<number> <optional>
Returns:
void -
draw(g, rect, params) → {void}
-
组件绘制方法
Parameters:
Name Type Description g
CanvasRenderingContext2D 画笔
rect
Rect 绘制区域
params
any 组件属性
Returns:
void -
drawCompBackground(g, bg) → {void}
-
Parameters:
Name Type Description g
CanvasRenderingContext2D bg
string | CanvasGradient Returns:
void -
drawCompBorder(g, strokeColor) → {void}
-
边框绘制,会自动减去边框大小,保证线在组件区域内
Parameters:
Name Type Attributes Description g
CanvasRenderingContext2D strokeColor
string | CanvasGradient <optional>
Returns:
void -
drawImpl(g, rect, params) → {void}
-
Parameters:
Name Type Description g
CanvasRenderingContext2D rect
Rect params
any Returns:
void -
fireEvent(event) → {void}
-
Parameters:
Name Type Description event
ht.drawing.CompEvent Returns:
void -
formatText(text, formatter, getFormatter, drawData) → {string}
-
格式化字符串
Parameters:
Name Type Attributes Description text
string 字符串内容
formatter
string <optional>
模板串,如 formatText('50', '{0}%') 得到 50%
getFormatter
Object <optional>
drawData
ht.Data <optional>
绘制数据,可能是表格的某行数据
Returns:
string -
formatToolTip(label, funcInfo) → {string}
-
Parameters:
Name Type Description label
string funcInfo
any Returns:
string -
getBodyColor() → {string|CanvasGradient}
-
获得图元上的染色值
Returns:
string | CanvasGradient -
getCloneRect() → {Rect}
-
返回一个复制后的矩形区域
Returns:
Rect -
getCompName() → {string}
-
返回组件名称
Returns:
string -
getDefaultFomatter(funcInfo) → {string}
-
Parameters:
Name Type Description funcInfo
any Returns:
string -
getDefaultValue(paramName) → {any}
-
Parameters:
Name Type Description paramName
string Returns:
any -
getDraggingData() → {Object}
-
Returns:
Object -
getDraggingImageInfo() → {Object}
-
Returns:
Object -
getDraggingTip() → {Object}
-
Returns:
Object -
getInnerAttr(name, defaultValue) → {any}
-
获取当前绘制组件的属性值
Parameters:
Name Type Description name
string defaultValue
any Returns:
any -
getTransitionValue(key, curentValue) → {any}
-
Parameters:
Name Type Description key
string curentValue
any Returns:
any -
handleDrag(draggingData, event, logicalPoint) → {void}
-
Parameters:
Name Type Description draggingData
Object event
UIEvent logicalPoint
Point Returns:
void -
handleDragEnter(draggingData, event, logicalPoint) → {void}
-
Parameters:
Name Type Description draggingData
Object event
UIEvent logicalPoint
Point Returns:
void -
handleDragLeave(draggingData, event, logicalPoint) → {void}
-
Parameters:
Name Type Description draggingData
Object event
UIEvent logicalPoint
Point Returns:
void -
handleDrop(draggingData, event, logicalPoint) → {void}
-
Parameters:
Name Type Description draggingData
Object event
UIEvent logicalPoint
Point Returns:
void -
handleRectChange() → {void}
-
rect 区域发生变化时回调
Returns:
void -
hasTransition(paramName, matchStart) → {boolean}
-
Parameters:
Name Type Description paramName
string matchStart
boolean Returns:
boolean -
init(rect, params) → {void}
-
Parameters:
Name Type Description rect
Rect params
any Returns:
void -
invalidateData(e) → {void}
-
Parameters:
Name Type Attributes Description e
any <optional>
Returns:
void -
isTransitionEnabled() → {boolean}
-
Returns:
boolean -
onDestory() → {string}
-
Returns:
string -
removeEventListener(func) → {void}
-
Parameters:
Name Type Description func
function Returns:
void -
removeTransition(key, matchStart) → {void}
-
Parameters:
Name Type Description key
string matchStart
boolean Returns:
void -
setCursor(cursor) → {void}
-
Parameters:
Name Type Description cursor
string Returns:
void -
setTransitionToValue(key, value) → {any}
-
Parameters:
Name Type Description key
string value
any Returns:
any -
showLabelToolTip(event, label, funcInfo) → {void}
-
Parameters:
Name Type Description event
UIEvent label
string funcInfo
any Returns:
void -
toBlendedColor(color) → {string|CanvasGradient}
-
获取染色后的颜色值,注意不是从 comp 上直接获取的属性,不会受到灰化、染色的影响,需通过此方法进行转换
Parameters:
Name Type Description color
string | CanvasGradient Returns:
string | CanvasGradient -
toToolTipTemplateList(label, funcInfo) → {Array.<any>}
-
Parameters:
Name Type Description label
string funcInfo
any Returns:
Array.<any>