add interface LengthMetric

Signed-off-by: xiangshouxing <xiangshouxing@huawei.com>
Change-Id: I0b6910d6f3bd3ceb1eed420f38fdfc8bcf4ea20d
Signed-off-by: xiangshouxing <xiangshouxing@huawei.com>
This commit is contained in:
xiangshouxing 2024-04-12 10:18:41 +00:00
parent efa9f0ae7f
commit 7d8bd5a868
3 changed files with 111 additions and 10 deletions

View File

@ -61,7 +61,7 @@ export { DrawContext, Size, Offset, Position, Pivot, Scale, Translation, Matrix4
* @crossplatform
* @since 12
*/
export { LengthUnit, SizeT, LengthMetric } from './arkui/Graphics';
export { LengthUnit, SizeT, LengthMetrics } from './arkui/Graphics';
/**
* Export RenderNode. RenderNode contains node tree operations and render property operations on node.

View File

@ -20,7 +20,7 @@
import { UIContext } from '../@ohos.arkui.UIContext';
import { RenderNode } from './RenderNode';
import { Size, Position, Edges, LengthMetric, SizeT } from './Graphics';
import { Size, Position, Edges, LengthMetrics, SizeT } from './Graphics';
import { UICommonEvent } from 'commonEvent';
import { CommonAttribute } from 'commonAttribute';
@ -246,42 +246,42 @@ export class FrameNode {
/**
* Get the user config border width of the FrameNode.
*
* @returns { Edges<LengthMetric> } - Returns the user config border width of the FrameNode.
* @returns { Edges<LengthMetrics> } - Returns the user config border width of the FrameNode.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
getUserConfigBorderWidth(): Edges<LengthMetric>;
getUserConfigBorderWidth(): Edges<LengthMetrics>;
/**
* Get the user config padding of the FrameNode.
*
* @returns { Edges<LengthMetric> } - Returns the user config padding of the FrameNode.
* @returns { Edges<LengthMetrics> } - Returns the user config padding of the FrameNode.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
getUserConfigPadding(): Edges<LengthMetric>;
getUserConfigPadding(): Edges<LengthMetrics>;
/**
* Get the user config margin of the FrameNode.
*
* @returns { Edges<LengthMetric> } - Returns the user config margin of the FrameNode.
* @returns { Edges<LengthMetrics> } - Returns the user config margin of the FrameNode.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
getUserConfigMargin(): Edges<LengthMetric>;
getUserConfigMargin(): Edges<LengthMetrics>;
/**
* Get the user config size of the FrameNode.
*
* @returns { SizeT<LengthMetric> } - Returns the user config size of the FrameNode.
* @returns { SizeT<LengthMetrics> } - Returns the user config size of the FrameNode.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
getUserConfigSize(): SizeT<LengthMetric>;
getUserConfigSize(): SizeT<LengthMetrics>;
/**
* Get the id of the FrameNode.

View File

@ -721,6 +721,107 @@ declare class LengthMetric {
public value: number;
}
/**
* Defines the Length Metrics.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
declare class LengthMetrics {
/**
* Constructor.
*
* @param { number } value - The value of length.
* @param { LengthUnit } [unit] - The length unit.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
constructor(value: number, unit?:LengthUnit);
/**
* Init a lengthMetrics with px unit.
*
* @param { number } value - The value of the length metrics.
* @returns { LengthMetrics } Returns the lengthMetrics object with unit px.
* @static
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
static px(value: number): LengthMetrics;
/**
* Init a lengthMetrics with vp unit.
*
* @param { number } value - The value of the length metrics.
* @returns { LengthMetrics } - Returns the lengthMetrics object with unit vp.
* @static
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
static vp(value: number): LengthMetrics;
/**
* Init a lengthMetrics with fp unit.
*
* @param { number } value - The value of the length metrics.
* @returns { LengthMetrics } Returns the lengthMetrics object with unit fp.
* @static
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
static fp(value: number): LengthMetrics;
/**
* Init a lengthMetrics with percent unit.
*
* @param { number } value - The value of the length metrics.
* @returns { LengthMetrics } Returns the lengthMetrics object with unit percent.
* @static
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
static percent(value: number): LengthMetrics;
/**
* Init a lengthMetrics with lpx unit.
*
* @param { number } value - The value of the length metrics.
* @returns { LengthMetrics } Returns the lengthMetrics object with unit lpx.
* @static
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
static lpx(value: number): LengthMetrics;
/**
* The unit of the LengthMetrics. The default value is VP.
*
* @type { LengthUnit }
* @default VP
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
public unit: LengthUnit;
/**
* The value of the LengthMetrics.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 12
*/
public value: number;
}
/**
* Defines the Corner property.
*