提交 d036f07e 编写于 作者: M match

示例代码整改

Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
Signed-off-by: Nmatch <zhouqingfeng2@huawei.com>
上级 afe0dd99
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件的背景色。 | | backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件的背景色。 |
| backgroundImage | src:&nbsp;[ResourceStr](ts-types.md#resourcestr),<br/>repeat?:&nbsp;[ImageRepeat](ts-appendix-enums.md#imagerepeat) | src:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。<br/>repeat:设置背景图片的重复样式,默认不重复。 | | backgroundImage | src:&nbsp;[ResourceStr](ts-types.md#resourcestr),<br/>repeat?:&nbsp;[ImageRepeat](ts-appendix-enums.md#imagerepeat) | src:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。<br/>repeat:设置背景图片的重复样式,默认不重复。 |
| backgroundImageSize | {<br/>width?:&nbsp;[Length](ts-types.md#length),<br/>height?:&nbsp;[Length](ts-types.md#length)<br/>}&nbsp;\|&nbsp;[ImageSize](ts-appendix-enums.md#imagesize) | 设置背景图像的高度和宽度。当输入为{width:&nbsp;Length,&nbsp;height:&nbsp;Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。<br/>默认值:ImageSize.Auto | | backgroundImageSize | {<br/>width?:&nbsp;[Length](ts-types.md#length),<br/>height?:&nbsp;[Length](ts-types.md#length)<br/>}&nbsp;\|&nbsp;[ImageSize](ts-appendix-enums.md#imagesize) | 设置背景图像的高度和宽度。当输入为{width:&nbsp;Length,&nbsp;height:&nbsp;Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。<br/>默认值:ImageSize.Auto |
| backgroundImagePosition | [Position](ts-types.md#position8)&nbsp;\|&nbsp;[Alignment](ts-appendix-enums.md#alignment) | 设置背景图在组件中显示位置。<br/>默认值:{x:&nbsp;0,y:&nbsp;0} | | backgroundImagePosition | [Position](ts-types.md#position8)&nbsp;\|&nbsp;[Alignment](ts-appendix-enums.md#alignment) | 设置背景图在组件中显示位置。<br/>默认值:<br/>{<br/>x:&nbsp;0,<br/>y:&nbsp;0<br/>} |
## 示例 ## 示例
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
| 名称 | 类型 | 描述 | | 名称 | 类型 | 描述 |
| ---------- | ---------------------------------------- | --------------------------------------- | | ---------- | ---------------------------------------- | --------------------------------------- |
| source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | 边框图源或者渐变色设置。 | | source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | 边框图源或者渐变色设置。 |
| slice | [Length](ts-types.md#length)\| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框切割宽度。<br/>默认值:0 | | slice | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框切割宽度。<br/>默认值:0 |
| width | [Length](ts-types.md#length)\| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框宽度。<br/>默认值:0 | | width | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置图片边框宽度。<br/>默认值:0 |
| outset | [Length](ts-types.md#length)\| [EdgeWidths](ts-types.md#edgewidths9) | 设置边框图片向外延伸距离。<br/>默认值:0 | | outset | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | 设置边框图片向外延伸距离。<br/>默认值:0 |
| RepeatMode | RepeatMode | 设置边框图片的重复方式。<br/>默认值:RepeatMode.Stretch | | repeat | [RepeatMode](#repeatmode枚举说明) | 设置边框图片的重复方式。<br/>默认值:RepeatMode.Stretch |
| fill | boolean | 设置边框图片中心填充。<br/>默认值:false | | fill | boolean | 设置边框图片中心填充。<br/>默认值:false |
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
| 名称 | 参数类型 | 描述 | | 名称 | 参数类型 | 描述 |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| border | {<br/>width?:&nbsp;[Length](ts-types.md#length)&nbsp;\|&nbsp;[EdgeWidths<sup>9+</sup>](#edgewidths9对象说明),<br/>color?: &nbsp;[ResourceColor](ts-types.md#resourcecolor)&nbsp;\|&nbsp;[EdgeColors<sup>9+</sup>](#edgecolors9对象说明),<br/>radius?: &nbsp;[Length](ts-types.md#length)&nbsp;\|&nbsp;[BorderRadiuses<sup>9+</sup>](#borderradiuses9对象说明),<br/>style?:&nbsp;[BorderStyle](ts-appendix-enums.md#borderstyle)&nbsp;\|&nbsp;[EdgeStyles<sup>9+</sup>](#edgestyles9对象说明)<br/>} | 统一边框样式设置接口。<br/>-&nbsp;width:设置边框宽度。<br/>-&nbsp;color:设置边框颜色。<br/>-&nbsp;radius:设置边框圆角半径。<br/>-&nbsp;style:设置边框样式。 | | border | {<br/>width?:&nbsp;[Length](ts-types.md#length)&nbsp;\|&nbsp;[EdgeWidths](#edgewidths9对象说明)<sup>9+</sup>,<br/>color?: &nbsp;[ResourceColor](ts-types.md#resourcecolor)&nbsp;\|&nbsp;[EdgeColors](#edgecolors9对象说明)<sup>9+</sup>,<br/>radius?: &nbsp;[Length](ts-types.md#length)&nbsp;\|&nbsp;[BorderRadiuses](#borderradiuses9对象说明)<sup>9+</sup>,<br/>style?:&nbsp;[BorderStyle](ts-appendix-enums.md#borderstyle)&nbsp;\|&nbsp;[EdgeStyles](#edgestyles9对象说明)<sup>9+</sup><br/>} | 统一边框样式设置接口。<br/>-&nbsp;width:设置边框宽度。<br/>-&nbsp;color:设置边框颜色。<br/>-&nbsp;radius:设置边框圆角半径。<br/>-&nbsp;style:设置边框样式。 |
| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles<sup>9+</sup>](#edgestyles9对象说明) | 设置元素的边框样式。<br/>默认值:BorderStyle.Solid | | borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)<sup>9+</sup> | 设置元素的边框样式。<br/>默认值:BorderStyle.Solid |
| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths<sup>9+</sup>](#edgewidths9对象说明) | 设置元素的边框宽度,不支持百分比。 | | borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)<sup>9+</sup> | 设置元素的边框宽度,不支持百分比。 |
| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors<sup>9+</sup>](#edgecolors9对象说明) | 设置元素的边框颜色。 | | borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)<sup>9+</sup> | 设置元素的边框颜色。 |
| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses<sup>9+</sup>](#borderradiuses9对象说明) | 设置元素的边框圆角半径,不支持百分比。 | | borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)<sup>9+</sup> | 设置元素的边框圆角半径,不支持百分比。 |
## EdgeWidths<sup>9+</sup>对象说明 ## EdgeWidths<sup>9+</sup>对象说明
......
...@@ -172,7 +172,7 @@ struct IdExample { ...@@ -172,7 +172,7 @@ struct IdExample {
console.info(getInspectorTree()) console.info(getInspectorTree())
this.text = "Button 'click to start' is clicked" this.text = "Button 'click to start' is clicked"
setTimeout(() => { setTimeout(() => {
sendEventByKey("longClick", 11, "") //id为"longClick"的组件发送长按事件 sendEventByKey("longClick", 11, "") //id为"longClick"的组件发送长按事件
}, 2000) }, 2000)
}).id('click') }).id('click')
...@@ -184,18 +184,18 @@ struct IdExample { ...@@ -184,18 +184,18 @@ struct IdExample {
console.info('long clicked') console.info('long clicked')
this.text = "Button 'longClick' is longclicked" this.text = "Button 'longClick' is longclicked"
setTimeout(() => { setTimeout(() => {
let rect = Utils.getComponentRect('onTouch') //获取id为"onTouch"组件的矩形区域坐标 let rect = Utils.getComponentRect('onTouch') // 获取id为"onTouch"组件的矩形区域坐标
let touchPoint: TouchObject = { let touchPoint: TouchObject = {
id: 1, id: 1,
x: rect.left + (rect.right - rect.left) / 2, //组件中心点x坐标 x: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
y: rect.top + (rect.bottom - rect.top) / 2, //组件中心点y坐标 y: rect.top + (rect.bottom - rect.top) / 2, // 组件中心点y坐标
type: TouchType.Down, type: TouchType.Down,
screenX: rect.left + (rect.right - rect.left) / 2, //组件中心点x坐标 screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
screenY: rect.left + (rect.right - rect.left) / 2, //组件中心点y坐标 screenY: rect.left + (rect.right - rect.left) / 2, // 组件中心点y坐标
} }
sendTouchEvent(touchPoint) //发送触摸事件 sendTouchEvent(touchPoint) // 发送触摸事件
touchPoint.type = TouchType.Up touchPoint.type = TouchType.Up
sendTouchEvent(touchPoint) //发送触摸事件 sendTouchEvent(touchPoint) // 发送触摸事件
}, 2000) }, 2000)
})).id('longClick') })).id('longClick')
...@@ -206,14 +206,14 @@ struct IdExample { ...@@ -206,14 +206,14 @@ struct IdExample {
console.info('onTouch is clicked') console.info('onTouch is clicked')
this.text = "Button 'onTouch' is clicked" this.text = "Button 'onTouch' is clicked"
setTimeout(() => { setTimeout(() => {
let rect = Utils.getComponentRect('onMouse') //获取id为"onMouse"组件的矩形区域坐标 let rect = Utils.getComponentRect('onMouse') // 获取id为"onMouse"组件的矩形区域坐标
let mouseEvent: MouseEvent = { let mouseEvent: MouseEvent = {
button: MouseButton.Left, button: MouseButton.Left,
action: MouseAction.Press, action: MouseAction.Press,
x: rect.left + (rect.right - rect.left) / 2, //组件中心点x坐标 x: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
y: rect.top + (rect.bottom - rect.top) / 2, //组件中心点y坐标 y: rect.top + (rect.bottom - rect.top) / 2, // 组件中心点y坐标
screenX: rect.left + (rect.right - rect.left) / 2, //组件中心点x坐标 screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
screenY: rect.top + (rect.bottom - rect.top) / 2, //组件中心点y坐标 screenY: rect.top + (rect.bottom - rect.top) / 2, // 组件中心点y坐标
timestamp: 1, timestamp: 1,
target: { target: {
area: { area: {
...@@ -231,7 +231,7 @@ struct IdExample { ...@@ -231,7 +231,7 @@ struct IdExample {
}, },
source: SourceType.Mouse source: SourceType.Mouse
} }
sendMouseEvent(mouseEvent) //发送鼠标事件 sendMouseEvent(mouseEvent) // 发送鼠标事件
}, 2000) }, 2000)
}).id('onTouch') }).id('onTouch')
...@@ -251,7 +251,7 @@ struct IdExample { ...@@ -251,7 +251,7 @@ struct IdExample {
metaKey: 0, metaKey: 0,
timestamp: 0 timestamp: 0
} }
sendKeyEvent(keyEvent) //发送按键事件 sendKeyEvent(keyEvent) // 发送按键事件
}, 2000) }, 2000)
}).id('onMouse') }).id('onMouse')
......
# 触摸测试控制 # 触摸测试控制
设置组件的触摸测试类型。ArkUI开发框架在处理触屏事件时,会在触屏事件触发前,进行按压点和组件区域的触摸测试来收集需要响应触屏事件的组件,然后基于触摸测试结果分发相应的触屏事件。hitTestBehavior属性可以设置不同的触摸测试响应模式,影响组件的触摸测试收集结果,最终影响后续的触屏事件分发,具体影响参考[HitTestMode](#hittestmode 枚举说明)枚举说明。 设置组件的触摸测试类型。ArkUI开发框架在处理触屏事件时,会在触屏事件触发前,进行按压点和组件区域的触摸测试来收集需要响应触屏事件的组件,然后基于触摸测试结果分发相应的触屏事件。hitTestBehavior属性可以设置不同的触摸测试响应模式,影响组件的触摸测试收集结果,最终影响后续的触屏事件分发,具体影响参考[HitTestMode](#hittestmode枚举说明)枚举说明。
> **说明:** > **说明:**
> - 从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > - 从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
| **名称** | **参数类型** | **描述** | | **名称** | **参数类型** | **描述** |
| -------------------- | -------- | ---------------------------------------- | | -------------------- | -------- | ---------------------------------------- |
| hitTestBehavior | [HitTestMode](#hittestmode 枚举说明) | 设置当前组件的触摸测试类型。<br>默认值: HitTestMode.Default | | hitTestBehavior | [HitTestMode](#hittestmode枚举说明) | 设置当前组件的触摸测试类型。<br>默认值: HitTestMode.Default |
## HitTestMode 枚举说明 ## HitTestMode枚举说明
| 名称 | 描述 | | 名称 | 描述 |
| ------------| ----------------------------------------- | | ------------| ----------------------------------------- |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册