LayerTree🧪
✅️️ Methods
🔨LayerTree.compositingReasons
提供给定图层被合成的原因。
EN
Provides the reasons why the given layer was composited.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| layerId | ✔️ | LayerId | 我们想要获取其合成原因的图层的ID。 | ENThe id of the layer for which we want to get the reasons it was composited. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| compositingReasons | array[string] | 指定给定图层成为合成图层的原因的字符串列表。 | ENA list of strings specifying reasons for the given layer to become composited. |
| compositingReasonIds | array[string] | 指定给定图层成为合成层的原因ID的字符串列表。 | ENA list of strings specifying reason IDs for the given layer to become composited. |
🔨LayerTree.disable
禁用合成树检查。
EN
Disables compositing tree inspection.
🔨LayerTree.enable
启用合成树检查。
EN
Enables compositing tree inspection.
🔨LayerTree.loadSnapshot
返回快照标识符。
EN
Returns the snapshot identifier.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| tiles | ✔️ | array[PictureTile] | 组成快照的图块数组。 | ENAn array of tiles composing the snapshot. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| snapshotId | SnapshotId | 快照的id。 | ENThe id of the snapshot. |
🔨LayerTree.makeSnapshot
返回图层快照标识符。
EN
Returns the layer snapshot identifier.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| layerId | ✔️ | LayerId | 图层的id。 | ENThe id of the layer. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| snapshotId | SnapshotId | 图层快照的id。 | ENThe id of the layer snapshot. |
🔨LayerTree.profileSnapshot
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| snapshotId | ✔️ | SnapshotId | 图层快照的id。 | ENThe id of the layer snapshot. | |
| minRepeatCount | integer | 重放快照的最大次数(如果未指定,则为1)。 | ENThe maximum number of times to replay the snapshot (1, if not specified). | ||
| minDuration | number | 回放快照的最小持续时间(以秒为单位)。 | ENThe minimum duration (in seconds) to replay the snapshot. | ||
| clipRect | DOM.Rect | 在重放快照时应用的裁剪矩形。 | ENThe clip rectangle to apply when replaying the snapshot. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| timings | array[PaintProfile] | 每次运行对应的绘制配置文件数组,每个运行一个。 | ENThe array of paint profiles, one per run. |
🔨LayerTree.releaseSnapshot
后端捕获的''Releases''层快照。
EN
Releases layer snapshot captured by the back-end.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| snapshotId | ✔️ | SnapshotId | 图层快照的id。 | ENThe id of the layer snapshot. |
🔨LayerTree.replaySnapshot
重放图层快照并返回生成的位图。
EN
Replays the layer snapshot and returns the resulting bitmap.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| snapshotId | ✔️ | SnapshotId | 图层快照的id。 | ENThe id of the layer snapshot. | |
| fromStep | integer | 从(如果未指定,则从最开始)开始重放的第一步。 | ENThe first step to replay from (replay from the very start if not specified). | ||
| toStep | integer | 要重放到的最后一步(如果未指定,则重放至结束)。 | ENThe last step to replay to (replay till the end if not specified). | ||
| scale | number | 在回放过程中应用的缩放比例(默认为1)。 | ENThe scale to apply while replaying (defaults to 1). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| dataURL | string | 一个用于结果图像的 data: URL。 | ENA data: URL for resulting image. |
🔨LayerTree.snapshotCommandLog
重放图层快照并返回画布日志。
EN
Replays the layer snapshot and returns canvas log.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| snapshotId | ✔️ | SnapshotId | 图层快照的id。 | ENThe id of the layer snapshot. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| commandLog | array[object] | 画布函数调用的数组。 | ENThe array of canvas function calls. |
✅️️ Events
👋LayerTree.layerPainted
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| layerId | ✔️ | LayerId | 已绘制图层的id。 | ENThe id of the painted layer. | |
| clip | ✔️ | DOM.Rect | 裁剪矩形。 | ENClip rectangle. |
👋LayerTree.layerTreeDidChange
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| layers | array[Layer] | 图层树,如果不在合成模式下则不存在。 | ENLayer tree, absent if not in the compositing mode. |
✅️️ Types
📌LayerTree.Layer
关于合成层的信息。
EN
Information about a compositing layer.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| layerId | ✔️ | LayerId | 此图层的唯一标识符。 | ENThe unique id for this layer. | |
| parentLayerId | LayerId | 父级ID(根节点不存在)。 | ENThe id of parent (not present for root). | ||
| backendNodeId | DOM.BackendNodeId | 与此图层关联的节点的后端标识符。 | ENThe backend id for the node associated with this layer. | ||
| offsetX | ✔️ | number | 相对于父图层的偏移量,X坐标。 | ENOffset from parent layer, X coordinate. | |
| offsetY | ✔️ | number | 从父层偏移,Y坐标。 | ENOffset from parent layer, Y coordinate. | |
| width | ✔️ | number | 图层宽度。 | ENLayer width. | |
| height | ✔️ | number | 图层高度。 | ENLayer height. | |
| transform | array[number] | 图层变换矩阵,默认为单位矩阵 | ENTransformation matrix for layer, default is identity matrix | ||
| anchorX | number | 变换锚点X,若未指定变换则不存在 | ENTransform anchor point X, absent if no transform specified | ||
| anchorY | number | 变换锚点Y,如果未指定变换则不存在 | ENTransform anchor point Y, absent if no transform specified | ||
| anchorZ | number | 变换锚点Z,如果未指定变换则不存在 | ENTransform anchor point Z, absent if no transform specified | ||
| paintCount | ✔️ | integer | 表示该图层已绘制的次数。 | ENIndicates how many time this layer has painted. | |
| drawsContent | ✔️ | boolean | 指示该图层是否承载任何内容,而非仅用于变换/滚动目的。 | ENIndicates whether this layer hosts any content, rather than being used for transform/scrolling purposes only. | |
| invisible | boolean | 设置图层是否不可见。 | ENSet if layer is not visible. | ||
| scrollRects | array[ScrollRect] | 仅在主线程上滚动的矩形。 | ENRectangles scrolling on main thread only. | ||
| stickyPositionConstraint | StickyPositionConstraint | 粘性位置约束信息 | ENSticky position constraint information |
📌LayerTree.LayerId
唯一的图层标识符。
EN
Unique Layer identifier.
返回类型:string
📌LayerTree.PaintProfile
时间点数组,每个绘制步骤一个。
EN
Array of timings, one per paint step.
返回类型:array
📌LayerTree.PictureTile
图层图片的序列化片段及其在图层内的偏移量。
EN
Serialized fragment of layer picture along with its offset within the layer.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| x | ✔️ | number | 从所属层左边界偏移 | ENOffset from owning layer left boundary | |
| y | ✔️ | number | 从所属图层顶部边界的偏移量 | ENOffset from owning layer top boundary | |
| picture | ✔️ | string | Base64编码的快照数据。(通过JSON传递时编码为base64字符串) | ENBase64-encoded snapshot data. (Encoded as a base64 string when passed over JSON) |
📌LayerTree.ScrollRect
主线程上发生滚动的矩形区域。
EN
Rectangle where scrolling happens on the main thread.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| rect | ✔️ | DOM.Rect | 矩形本身。 | ENRectangle itself. | |
| type | ✔️ | string | 矩形强制在主线程滚动的原因 允许的值: RepaintsOnScroll、TouchEventHandler、WheelEventHandler | ENReason for rectangle to force scrolling on the main threadAllowed Values: RepaintsOnScroll, TouchEventHandler, WheelEventHandler |
📌LayerTree.SnapshotId
唯一的快照标识符。
EN
Unique snapshot identifier.
返回类型:string
📌LayerTree.StickyPositionConstraint
粘性定位约束。
EN
Sticky position constraints.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| stickyBoxRect | ✔️ | DOM.Rect | 粘性元素在发生偏移前的布局矩形 | ENLayout rectangle of the sticky element before being shifted | |
| containingBlockRect | ✔️ | DOM.Rect | 粘性元素包含块的布局矩形 | ENLayout rectangle of the containing block of the sticky element | |
| nearestLayerShiftingStickyBox | LayerId | 最近的粘性层,该层会移动粘性框 | ENThe nearest sticky layer that shifts the sticky box | ||
| nearestLayerShiftingContainingBlock | LayerId | ''和``里面的内容保持不变,翻译如下: 最近导致包含块偏移的粘性层 | ENThe nearest sticky layer that shifts the containing block |