Optional
opts: GroupPropsProtected
_$eventIf element is used as a component of other element.
If element has been moved to the hover layer.
If so, dirty will only trigger the render2d refresh hover layer
If element was painted on the screen
Render2D instance will be assigned when element is associated with render2d
Protected
_normalWill translated the element to the anchor position before applying other transforms.
Id for mapping animation
The string value of textPosition
needs to be calculated to a real postion.
For example, 'inside'
is calculated to [rect.width/2, rect.height/2]
by default. See contain/text.js#calculateTextPosition
for more details.
But some coutom shapes like "pin", "flag" have center that is not exactly
[width/2, height/2]
. So we provide this hook to customize the calculation
for those shapes. It will be called if the style.textPosition
is a string.
Prepared out object. If not provided, this method should be responsible for creating one.
{x, y, width, height}
out The same as the input out. { x: number. mandatory. y: number. mandatory. align: string. optional. use style.textAlign by default. verticalAlign: string. optional. use style.textVerticalAlign by default. }
Optional
currentWhether it can be dragged.
Whether is it dragging.
Scale ratio
If ignore drawing and events of the element object
If ignore clip from it's parent or hosts. Applied on itself and all it's children.
NOTE: It won't affect the clipPath set on the children.
Readonly
is是否是 Group
Element name
Origin of scale, rotation, skew
Optional
prevWhether to respond to mouse events.
Optional
stateProxy function for getting state with given stateName. Render2D will first try to get with stateProxy. Then find from states if stateProxy returns nothing
targetStates will be given in useStates
Proxy function for getting state with given stateName. Render2D will first try to get with stateProxy. Then find from states if stateProxy returns nothing
targetStates will be given in useStates
Optional
targetStates: string[]Animation config applied on state switching.
Store of element state. 'normal' key is preserved for default properties.
Optional
textConfig of textContent. Inlcuding layout, color, ...etc.
Optional
textConfig for guide line calculating.
NOTE: This is just a property signature. READ and WRITE are all done in .
Element type
Static
Protected
initProtected
_applyProtected
_initOptional
props: GroupPropsProtected
_innerProtected
_mergeProtected
_saveProtected
_transitionOptional
cfg: ElementAnimateConfigOptional
animationProps: MapToType<GroupProps, boolean>添加子节点到最后
添加子节点在 nextSibling 之前
Add self from render2d instance. Not recursively because it will be invoked when element added to storage.
动画
Optional
key: stringOptional
loop: booleanWhether to loop animation.
Optional
allowDiscreteAnimation: booleanWhether to allow discrete animation @example: el.animate('style', false) .when(1000, {x: 10} ) .done(function(){ // Animation done }) .start()
Animate from the target state to current state.
The params and the value are the same as this.animateTo
.
Optional
animationProps: MapToType<GroupProps, boolean>Optional
cfg: ElementAnimateConfigOptional
animationProps: MapToType<GroupProps, boolean>A map to specify which property to animate. If not specified, will animate all.
// Animate position
el.animateTo({
position: [10, 10]
}, { done: () => { // done } })
// Animate shape, style and position in 100ms, delayed 100ms, with cubicOut easing
el.animateTo({
shape: {
width: 500
},
style: {
fill: 'red'
}
position: [10, 10]
}, {
duration: 100,
delay: 100,
easing: 'cubicOut',
done: () => { // done }
})
Protected
attrKVProtected
can获取指定 index 的儿子节点
获取指定名字的儿子节点
Get children copy.
Get children reference.
Drift element
dx on the global space
dy on the global space
Optional
e: ElementEventInterface of getting the minimum bounding box.
Optional
includeChildren: Element<ElementProps>[]Get computed global transform NOTE: this method will force update transform on all ancestors. Please be aware of the potential performance cost.
Get global scale
Optional
out: VectorArrayProtected
getProtected
getGet computed local transform
Optional
m: MatrixArrayProtected
getProtected
getBind a handler.
The event name.
The event handler.
Optional
context: CtxBind a handler.
The event name.
The event handler.
Optional
context: CtxRemove child
Remove self from render2d instance. Not recursively because it will be invoked when element added to storage.
Set layout of attached text. Will merge with the previous.
Attach text on element
Visit all descendants. Return false in callback to stop visit descendants of current node
Optional
context: TDispatch a event.
The event name.
Rest
...args: Parameters<({ Use state. State is a collection of properties. Will return current state object if state exists and stateName has been changed.
State name to be switched to
Optional
keepCurrentStates: booleanOptional
noAnimation: booleanOptional
forceUseHoverLayer: boolean
Dirty bits. From which painter will determine if this displayable object needs brush.