new ShapeStorage()
管理shape类
Methods
-
eachShape(func)
-
遍历shape
Parameters:
Name Type Description funcfunction 遍历函数
-
getShape(name, keyopt) → {Object}
-
根据name获取通过setShape或setShapeGroup方法设置的shape
Parameters:
Name Type Attributes Description namestring keystring <optional>
仅在shape为Group时有效
Returns:
Object -shape | shapeGroup
-
remove()
-
移除全部
-
removeShape(name)
-
移除指定的shape
Parameters:
Name Type Description namestring -
set(name, shape) → {Object}
-
直接设置shape
Parameters:
Name Type Description namestring shapeObject Returns:
Object -shape
-
setShape(name, Shape, shapeAttr, animateOption, initCallback) → {Object}
-
设置单个shape,若不存在则创建,若存在则更新
Parameters:
Name Type Description namestring 存储的名字
ShapeObject 要创建的Shape类
shapeAttrObject 要创建shape的相关属性attr
animateOptionObject 动画相关属性
Properties
Name Type Attributes Description animationboolean <optional>
是否动画
animateFromObject <optional>
动画起始状态属性,
durationnumber <optional>
动画时长
easingstring | function <optional>
动画类型
animateListObject <optional>
要过渡的动画属性列表
initCallbackfunction 初始化shape的回调
Returns:
Object -shape
-
setShapeGroup(name, Shape, shapeAttrArray, animateOption, initCallback, createCallback) → {Object}
-
设置一组shape,根据所设置的key创建新或移除
Parameters:
Name Type Description nameString 存储的名字
ShapeObject 要创建的Shape类
shapeAttrArrayArray 要创建shape的相关属性attr数组,!!!若需要动画,需指定每个shape的唯一key,以对对应的shape添加过渡动画!!!
animateOptionObject 动画相关属性
Properties
Name Type Attributes Description animationboolean <optional>
是否动画
animateFromObject <optional>
动画起始状态属性,
durationnumber <optional>
动画时长
easingstring | function <optional>
动画类型
animateListObject <optional>
要过渡的动画属性列表
animateLeaveObject <optional>
remove时动画属性列表
initCallbackfunction shapeGroup创建时的回调
createCallbackfunction shapeGroup内新增shape时的回调
Returns:
Object -shapeGroup