mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 22:24:20 +00:00
add measure and layout
Signed-off-by: xiangshouxing <xiangshouxing@huawei.com> Change-Id: I4769eac77e7c642fbd15d0b0558c50725894ab13 Signed-off-by: xiangshouxing <xiangshouxing@huawei.com>
This commit is contained in:
parent
4e0d9c39ad
commit
cb5e760ce1
2
api/@ohos.arkui.node.d.ts
vendored
2
api/@ohos.arkui.node.d.ts
vendored
@ -43,7 +43,7 @@ export { NodeController } from './arkui/NodeController';
|
|||||||
* @crossplatform
|
* @crossplatform
|
||||||
* @since 11
|
* @since 11
|
||||||
*/
|
*/
|
||||||
export { FrameNode } from './arkui/FrameNode';
|
export { FrameNode, LayoutConstraint } from './arkui/FrameNode';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export Graphics. Defines the basic types related to the Graphics.
|
* Export Graphics. Defines the basic types related to the Graphics.
|
||||||
|
116
api/arkui/FrameNode.d.ts
vendored
116
api/arkui/FrameNode.d.ts
vendored
@ -25,6 +25,47 @@ import { UICommonEvent } from 'commonEvent';
|
|||||||
import { CommonAttribute } from 'commonAttribute';
|
import { CommonAttribute } from 'commonAttribute';
|
||||||
import { DrawContext } from './Graphics';
|
import { DrawContext } from './Graphics';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Layout constraint, include the max size, the min size and the reference size for children to calculate percent.
|
||||||
|
*
|
||||||
|
* @interface LayoutConstraint
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
declare interface LayoutConstraint {
|
||||||
|
/**
|
||||||
|
* MaxSize
|
||||||
|
*
|
||||||
|
* @type { Size }
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
maxSize: Size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MinSize
|
||||||
|
*
|
||||||
|
* @type { Size }
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
minSize: Size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PercentReference, if the size unit of the child nodes is percentage, then they use PercentReference to calculate
|
||||||
|
* the px size.
|
||||||
|
*
|
||||||
|
* @type { Size }
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
percentReference: Size;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines FrameNode.
|
* Defines FrameNode.
|
||||||
*
|
*
|
||||||
@ -385,6 +426,81 @@ export class FrameNode {
|
|||||||
*/
|
*/
|
||||||
onDraw?(context: DrawContext): void;
|
onDraw?(context: DrawContext): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to measure the FrameNode and its content to determine the measured size. Use this method to override the
|
||||||
|
* default measure method when measuring the FrameNode.
|
||||||
|
*
|
||||||
|
* @param { LayoutConstraint } constraint - The layout constraint of the node, will be used when executed measure
|
||||||
|
* method.
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
onMeasure(constraint: LayoutConstraint): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to assign a position to the FrameNode and each of its children. Use this method to override the
|
||||||
|
* default layout method.
|
||||||
|
*
|
||||||
|
* @param { Position } position - The position of the node, will be used when executed layout method.
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
onLayout(position: Position): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the size of the FrameNode after measure, with unit PX.
|
||||||
|
*
|
||||||
|
* @param { Size } size - The size of the FrameNode after measure.
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
setMeasuredSize(size: Size): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the position to the parent of the FrameNode after layout, with unit PX.
|
||||||
|
*
|
||||||
|
* @param { Position } position - The position to the parent of the FrameNode after layout.
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
setLayoutPosition(position: Position): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called to find out how big the FrameNode should be. The parent node supplies constraint information. The
|
||||||
|
* actual measurement work of the FrameNode is performed in onMeasure or the default measure method.
|
||||||
|
*
|
||||||
|
* @param { LayoutConstraint } constraint - The layout constraint of the node, supplied by the parent node.
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
measure(constraint: LayoutConstraint): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called to assign position to the FrameNode and all of its descendants. The position is used to init
|
||||||
|
* the position of the frameNode, and the actual layout work of FrameNode is performed in onLayout or the default
|
||||||
|
* layout method.
|
||||||
|
*
|
||||||
|
* @param { Position } position - The position of the node, will be used when executed the layout method.
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
layout(position: Position): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark the frame node as need layout.
|
||||||
|
*
|
||||||
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||||
|
* @crossplatform
|
||||||
|
* @since 12
|
||||||
|
*/
|
||||||
|
setNeedsLayout(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidate the RenderNode in the FrameNode, which will cause a re-render of the RenderNode.
|
* Invalidate the RenderNode in the FrameNode, which will cause a re-render of the RenderNode.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user