Module: zrender/Storage

zrender/Storage

new require("zrender/Storage")()

Storage.js, line 37

内容仓库 (M)

Storage内容仓库模块

Author:
  • Kener (@Kener-林峰, kener.linfeng@gmail.com)
  • errorrik (errorrik@gmail.com)
  • pissang (https://github.com/pissang/)

Methods

addHover(shape)

Storage.js, line 287

添加高亮层数据

Name Type Description
shape module:zrender/shape/Base

addRoot(el)

Storage.js, line 313

添加图形(Shape)或者组(Group)到根节点

Name Type Description
el module:zrender/shape/Shape | module:zrender/Group

delHover()

Storage.js, line 296

清空高亮层数据

delRoot(elId)

Storage.js, line 326

删除指定的图形(Shape)或者组(Group)

Name Type Description
elId string | Array.<string> optional

如果为空清空整个Storage

dispose()

Storage.js, line 402

清空并且释放Storage

drift(shapeId, dx, dy)

Storage.js, line 261

移动指定的图形(Shape)或者组(Group)的位置

Name Type Description
shapeId string

形状唯一标识

dx number
dy number

getHoverShapes(update){Array.<module:zrender/shape/Base>}

Storage.js, line 111

返回hover层的形状数组

Name Type Default Description
update boolean false optional

是否在返回前更新图形的变换

getShapeList(update){Array.<module:zrender/shape/Base>}

Storage.js, line 143

返回所有图形的绘制队列

Name Type Default Description
update boolean false optional

是否在返回前更新该数组 详见module:zrender/shape/Base.prototype.updateShapeList

hasHoverShape(){boolean}

Storage.js, line 305

是否有图形在高亮层里

iterShape(fun, option)

Storage.js, line 61

遍历迭代器

Name Type Description
fun function

迭代回调函数,return true终止迭代

option Object optional

迭代参数,缺省为仅降序遍历普通层图形

Name Type Default Description
hover boolean true optional

是否是高亮层图形

normal string 'up' optional

是否是普通层图形,迭代时是否指定及z轴顺序

update boolean false optional

是否在迭代前更新形状列表

mod(elId, params)

Storage.js, line 220

修改图形(Shape)或者组(Group)

Name Type Description
elId string

唯一标识

params Object optional

参数

updateShapeList()

Storage.js, line 155

更新图形的绘制队列。 每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中, 最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列