From cb9764f31002a156a805a2b95e0b5898f37d4f0b Mon Sep 17 00:00:00 2001 From: luoying_ace Date: Tue, 27 Sep 2022 08:14:28 +0000 Subject: [PATCH] update zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md. Signed-off-by: luoying_ace --- .../ts-basic-gestures-rotationgesture.md | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md index 9dd8ca8ff8..1d1885e65f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md @@ -16,7 +16,7 @@ RotationGesture(value?: { fingers?: number, angle?: number }) | 参数名称 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | | fingers | number | 否 | 触发旋转的最少手指数, 最小为2指,最大为5指。
默认值:2 | -| angle | number | 否 | 触发旋转手势的最小改变度数,单位为deg。
默认值:1.0 | +| angle | number | 否 | 触发旋转手势的最小改变度数,单位为deg。
默认值:1 | ## 事件 @@ -36,26 +36,35 @@ RotationGesture(value?: { fingers?: number, angle?: number }) @Entry @Component struct RotationGestureExample { - @State angle: number = 0 + @State angle: number = 0; + @State rotateValue: number = 0; build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Text('RotationGesture angle:' + this.angle) - } - .height(100).width(200).padding(20).border({ width:1 }) - .margin(80).rotate({ x:1, y:2, z:3, angle: this.angle }) - .gesture( + Column() { + Column() { + Text('RotationGesture angle:' + this.angle) + } + .height(200) + .width(300) + .padding(20) + .border({ width: 3 }) + .margin(80) + .rotate({ angle: this.angle }) + // 双指旋转触发该手势事件 + .gesture( RotationGesture() .onActionStart((event: GestureEvent) => { - console.log('Rotation start') + console.info('Rotation start'); }) .onActionUpdate((event: GestureEvent) => { - this.angle = event.angle + this.angle = this.rotateValue + event.angle; }) .onActionEnd(() => { - console.log('Rotation end') + this.rotateValue = this.angle; + console.info('Rotation end'); }) - ) + ) + }.width('100%') } } ``` -- GitLab