ComponentView()

new ComponentView()

组件View类

Extends

Methods

eachShape(func)

遍历shape

Parameters:
Name Type Description
func function

遍历函数

Inherited From:

getShape(name, keyopt) → {Object}

根据name获取通过setShape或setShapeGroup方法设置的shape

Parameters:
Name Type Attributes Description
name string
key string <optional>

仅在shape为Group时有效

Returns:
Object -

shape | shapeGroup

Inherited From:

remove()

移除view内所有图形

Inherited From:

removeEdit(model, globalModel, global)

移除edit状态相关图形

Parameters:
Name Type Description
model Object
globalModel Object
global Object
Inherited From:

removeShape(name)

移除指定的shape

Parameters:
Name Type Description
name string
Inherited From:

render(model, globalModel, global)

渲染函数

Parameters:
Name Type Description
model Object
globalModel Object
global Object
Inherited From:

renderEdit(model, globalModel, global)

编辑状态渲染函数

Parameters:
Name Type Description
model Object
globalModel Object
global Object
Inherited From:

scale(offsetX, offsetY, wheelDelta)

缩放view

Parameters:
Name Type Description
offsetX number

缩放中线点X

offsetY number

缩放中心点Y

wheelDelta number

缩放比例

Inherited From:

set(name, shape) → {Object}

直接设置shape

Parameters:
Name Type Description
name string
shape Object
Returns:
Object -

shape

Inherited From:

setShape(name, Shape, shapeAttr, animateOption, initCallback) → {Object}

设置单个shape,若不存在则创建,若存在则更新

Parameters:
Name Type Description
name string

存储的名字

Shape Object

要创建的Shape类

shapeAttr Object

要创建shape的相关属性attr

animateOption Object

动画相关属性

Properties
Name Type Attributes Description
animation boolean <optional>

是否动画

animateFrom Object <optional>

动画起始状态属性,

duration number <optional>

动画时长

easing string | function <optional>

动画类型

animateList Object <optional>

要过渡的动画属性列表

initCallback function

初始化shape的回调

Returns:
Object -

shape

Inherited From:

setShapeGroup(name, Shape, shapeAttrArray, animateOption, initCallback, createCallback) → {Object}

设置一组shape,根据所设置的key创建新或移除

Parameters:
Name Type Description
name String

存储的名字

Shape Object

要创建的Shape类

shapeAttrArray Array

要创建shape的相关属性attr数组,!!!若需要动画,需指定每个shape的唯一key,以对对应的shape添加过渡动画!!!

animateOption Object

动画相关属性

Properties
Name Type Attributes Description
animation boolean <optional>

是否动画

animateFrom Object <optional>

动画起始状态属性,

duration number <optional>

动画时长

easing string | function <optional>

动画类型

animateList Object <optional>

要过渡的动画属性列表

animateLeave Object <optional>

remove时动画属性列表

initCallback function

shapeGroup创建时的回调

createCallback function

shapeGroup内新增shape时的回调

Returns:
Object -

shapeGroup

Inherited From: