MiniX自绘渲染跨平台框架
  • 框架说明
  • 声明式开发范式
  • 内置Api
指南
接口
  • Minix CLI
示例
  • 类Web框架

    • 框架说明
    • 类Web开发范式
    • 内置Api
  • 指南
  • 组件
  • 接口
  • 示例
  • 规范
  • DophinHybrid

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • DolphinWeex

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • 发布消息
  • 常见问题
  • 更新日志
  • 框架说明
  • 声明式开发范式
  • 内置Api
指南
接口
  • Minix CLI
示例
  • 类Web框架

    • 框架说明
    • 类Web开发范式
    • 内置Api
  • 指南
  • 组件
  • 接口
  • 示例
  • 规范
  • DophinHybrid

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • DolphinWeex

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • 发布消息
  • 常见问题
  • 更新日志
  • 组件通用信息

    • 通用事件

    • 通用属性

    • 手势处理

      • 绑定手势方法
      • 基础手势

        • TapGesture
        • LongPressGesture
        • PanGesture
        • PinchGesture
        • RotationGesture
          • 接口
          • 事件
          • 示例
        • SwipeGesture
      • 组合手势
  • 基础组件

  • 容器组件

  • 媒体组件

  • 绘制组件

  • 画布组件

  • 动画

  • 全局 UI 方法

  • 文档中涉及到的内置枚举值
  • 类型定义

# RotationGesture

说明: 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。

# 接口

RotationGesture(value?: { fingers?: number, angle?: number })

参数:

参数名称 参数类型 必填 参数描述
fingers number 否 触发旋转的最少手指数, 最小为2指,最大为5指。
默认值:2
angle number 否 触发旋转手势的最小改变度数,单位为度数。
默认值:1.0

# 事件

名称 功能描述
onActionStart(event: (event?: GestureEvent) => void) Rotation手势识别成功回调。
onActionUpdate(event: (event?: GestureEvent) => void) Rotation手势移动过程中回调。
onActionEnd(event: (event?: GestureEvent) => void) Rotation手势识别成功,手指抬起后触发回调。
onActionCancel(event: () => void) Rotation手势识别成功,接收到触摸取消事件触发回调。

# 示例

// xxx.ets
@Entry
@Component
struct RotationGestureExample {
  @State angle: number = 0;
  @State rotateValue: number = 0;

  build() {
    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.info('Rotation start');
        })
        .onActionUpdate((event: GestureEvent) => {
          this.angle = this.rotateValue + event.angle;
        })
        .onActionEnd(() => {
          this.rotateValue = this.angle;
          console.info('Rotation end');
        })
      )
    }.width('100%')
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

zh-cn_image_0000001174264372