当前位置: 首页 > news >正文

智慧树网站的章节题做不了邯郸网站优化

智慧树网站的章节题做不了,邯郸网站优化,建设中心小学网站,摄影网站制作教程上篇回顾:ArkTS开发系列之事件(2.8.1触屏、键鼠、焦点事件) 本篇内容:ArkTS开发系列之事件(2.8.2手势事件) 一、绑定手势方法 1. 常规手势绑定方法 Text(手势).fontSize(44).gesture(TapGesture().onAct…

上篇回顾:ArkTS开发系列之事件(2.8.1触屏、键鼠、焦点事件)

本篇内容:ArkTS开发系列之事件(2.8.2手势事件)

一、绑定手势方法

1. 常规手势绑定方法

 Text('手势').fontSize(44).gesture(TapGesture().onAction((event) => {console.error('event: ' + JSON.stringify(event))}))

2. 带优先级的手势绑定方法

  • 需要注意,子父组件绑定相同级别手势时,子组件优先响应,如果父组件绑定优先级手势方法,子组件为普通绑定手势方法,则父组件优先响应
    .priorityGesture(TapGesture().onAction((event)=>{console.error('parentGesture: ' + JSON.stringify(event))}))

3. 并行手势绑定方法

  • 当父组件绑定此手势方法时,父子组件可同时响应手势
    .parallelGesture(TapGesture().onAction((event)=>{console.error('parent event: ' + JSON.stringify(event))}))

二、单一手势

1. 点击手势(tapGesture)

      Text('手势').fontSize(44).gesture(TapGesture().onAction((event) => {console.error('event: ' + JSON.stringify(event))}))

2. 长按手势(longPressGesture)

LongPressGesture(value?:{fingers?:number; repeat?:boolean; duration?:number})
  • fingers :触发最少手指数,默认1
  • repeat 是否连续触发 默认false
  • duration 长按多久触发,默认500
Text('长按手势').fontSize(55).gesture(LongPressGesture({fingers: 1, repeat: true, duration: 300})//fingers :触发最少手指数,默认1  repeat 是否连续触发 默认false  duration 长按多久触发,默认500.onAction(event=>{console.error('longPress: ' + JSON.stringify(event))}))

3. 拖动手势(PanGesture)

PanGesture(value?:{ fingers?:number; direction?:PanDirection; distance?:number})
  • fingers: 触发手势最少手指数,默认1
  • direction:触发手势方向,默认值Pandirection.All
  • distance:触发手势的最少距离,单位为vp,默认5vp
  • 有点类似于onTouch事件
  Text('拖动手势').fontSize(44).gesture(PanGesture().onActionStart(event => {console.error('Pan start: ' + JSON.stringify(event))}).onActionUpdate(event => {console.error('Pan update: ' + JSON.stringify(event))}).onActionEnd(event => {console.error('Pan end: ' + JSON.stringify(event))}).onActionCancel(() => {console.error('Pan cancel: ')}))

4. 撮合手势(PinchGesture)

PinchGesture(value?:{fingers?:number; distance?:number})
  • fingers: 触发手势最少手指数,默认2, 最大值为5
  • distance:触发手势的最少距离,单位为vp,默认5vp
      Text('撮合手势').fontSize(44).gesture(PinchGesture().onActionStart(event => {console.error('Pinch start: ' + JSON.stringify(event))}).onActionUpdate(event => {console.error('Pinch update: ' + JSON.stringify(event))}).onActionEnd(event => {console.error('Pinch end: ' + JSON.stringify(event))}).onActionCancel(() => {console.error('Pinch cancel: ')}))

5. 旋转手势(RotationGesture)

RotationGesture(value?:{fingers?:number; angle?:number})
  • fingers: 触发手势最少手指数,默认2, 最大值为5
  • angle: 触发手势的最小改变度数,单位是deg,默认为1deg
 Text().fontSize(44).gesture(RotationGesture({fingers:2}).onActionStart(event => {console.error('Rotation start: ' + JSON.stringify(event))}).onActionUpdate(event => {console.error('Rotation update: ' + JSON.stringify(event))}).onActionEnd(event => {console.error('Rotation end: ' + JSON.stringify(event))}).onActionCancel(() => {console.error('Rotation cancel: ')}))

6. 滑动手势(SwipeGesture)

SwipeGesture(value?:{fingers?:number; direction?:SwipeDirection; speed?:number})
  • fingers: 触发手势最少手指数,默认1, 最大值为10
  • direction: 触发手势的方向默认值是 SwipeDirection.All
  • speed: 触发手势的最小滑动速度,单位为vp/s,默认值为100vp/s
    .gesture(SwipeGesture({ direction: SwipeDirection.Vertical }).onAction(event => {console.error('Swipe : ' + JSON.stringify(event))}))

三、组合手势

GestureGroup(mode:GestureMode, ...gesture:GestureType[])

mode: 声明组合手势的类型
gesture: 手势数组

1. 顺序组合

    .gesture(GestureGroup(GestureMode.Sequence,SwipeGesture({ direction: SwipeDirection.Vertical }).onAction(event => {console.error('Swipe : ' + JSON.stringify(event))}),LongPressGesture().onAction(event => {console.error('longPress : ' + JSON.stringify(event))})))

2. 并行组合

    .gesture(GestureGroup(GestureMode.Parallel,SwipeGesture({ direction: SwipeDirection.Vertical }).onAction(event => {console.error('Swipe : ' + JSON.stringify(event))}),LongPressGesture().onAction(event => {console.error('longPress : ' + JSON.stringify(event))})))

3. 互斥组合

    .gesture(GestureGroup(GestureMode.Exclusive,SwipeGesture({ direction: SwipeDirection.Vertical }).onAction(event => {console.error('Swipe : ' + JSON.stringify(event))}),LongPressGesture().onAction(event => {console.error('longPress : ' + JSON.stringify(event))})))
http://www.tj-hxxt.cn/news/93246.html

相关文章:

  • 深圳公明网站制作优化大师安卓版
  • wordpress x南京seo全网营销
  • 鲅鱼圈做网站网工资页多少钱一个月百度关键词搜索怎么收费
  • 建筑培训网课如何分步骤开展seo工作
  • 做花瓶的网站如何做seo
  • 上海虹口网站建设公司今天新闻
  • 长春做网站seo的seo快速排名软件品牌
  • 那个网站攻略做的好口碑营销案例ppt
  • 中国空间站建造完成网站分为哪几种类型
  • 政府网站建设讲话黑龙江seo关键词优化工具
  • 宁波网站建设在线深圳品牌策划公司
  • 企业网站模板网 凡建站徐州百度快照优化
  • 建设眼镜网站风格aso应用优化
  • 娱乐网站后缀是什么网络营销的内容有哪些方面
  • 一般网站建设公司semiconductor
  • 网站开发设计语言seo查询工具网站
  • 青岛企业网站推广小红书推广费用一般多少
  • 甘肃购物网站建设友链申请
  • 跟京东类似的网站东莞网络推广系统
  • 做旅行社的都是在哪网站拿票怎样制作网页
  • 网站流量合作网络推广好做吗多少钱
  • 孝感做招聘信息的网站百度seo优化教程免费
  • 装潢公司网站建设域名注册查询阿里云
  • 网站建设能用手机制作吗精准网络推广
  • 在线课程网站开发价格南阳本地网络推广优化公司
  • 如何自己设置网站哈尔滨seo优化软件
  • 如何用dw做网站首页百度客户端手机版
  • 必应网站收录在哪湖南网站seo推广
  • 做网站最基础需要什么条件百度广告怎么收费
  • 搭建网站需要多少钱关键词排名霸屏代做