1.add onClick option,because ImageKnifeComponet used onClick Event let external layout failed to capture events
Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
parent
fac8d53d33
commit
395b6f983e
|
@ -26,9 +26,10 @@ export struct ImageKnifeComponent {
|
||||||
@Watch('watchImageKnifeOption') @Link imageKnifeOption: ImageKnifeOption;
|
@Watch('watchImageKnifeOption') @Link imageKnifeOption: ImageKnifeOption;
|
||||||
@State componentWidth: string = '100%'
|
@State componentWidth: string = '100%'
|
||||||
@State componentHeight: string = '100%'
|
@State componentHeight: string = '100%'
|
||||||
@State gifPixelMap: PixelMap = undefined;
|
|
||||||
drawLifeCycle: IDrawLifeCycle
|
drawLifeCycle: IDrawLifeCycle
|
||||||
autoPlay = true
|
|
||||||
|
@State gifAutoPlay?:boolean = true;
|
||||||
|
autoPlay:boolean = true
|
||||||
// 有效onAreaChanged触发计数
|
// 有效onAreaChanged触发计数
|
||||||
private onAreaCount: number = 0
|
private onAreaCount: number = 0
|
||||||
private preSize: {
|
private preSize: {
|
||||||
|
@ -101,8 +102,13 @@ export struct ImageKnifeComponent {
|
||||||
.backgroundColor(this.imageKnifeOption.backgroundColor ? this.imageKnifeOption.backgroundColor : Color.White)
|
.backgroundColor(this.imageKnifeOption.backgroundColor ? this.imageKnifeOption.backgroundColor : Color.White)
|
||||||
.margin(this.imageKnifeOption.margin ? this.imageKnifeOption.margin : { left: 0, top: 0, right: 0, bottom: 0 })
|
.margin(this.imageKnifeOption.margin ? this.imageKnifeOption.margin : { left: 0, top: 0, right: 0, bottom: 0 })
|
||||||
.onReady(() => {
|
.onReady(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
.onClick(() => {
|
.onClick((event:ClickEvent) => {
|
||||||
|
// 需要将点击事件回传
|
||||||
|
if(this.imageKnifeOption.onClick){
|
||||||
|
this.imageKnifeOption.onClick(event)
|
||||||
|
}
|
||||||
if (this.imageKnifeOption.canRetryClick && this.hasDisplayRetryholder) {
|
if (this.imageKnifeOption.canRetryClick && this.hasDisplayRetryholder) {
|
||||||
this.retryClick()
|
this.retryClick()
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,9 @@ export class ImageKnifeOption {
|
||||||
// 用户自定义实现 绘制方案
|
// 用户自定义实现 绘制方案
|
||||||
drawLifeCycle?: IDrawLifeCycle;
|
drawLifeCycle?: IDrawLifeCycle;
|
||||||
|
|
||||||
|
// 设置点击事件回调
|
||||||
|
onClick?:(event?: ClickEvent) => void
|
||||||
|
|
||||||
gif?: {
|
gif?: {
|
||||||
loopFinish?: (loopTime?) => void
|
loopFinish?: (loopTime?) => void
|
||||||
speedFactory?: number
|
speedFactory?: number
|
||||||
|
|
Loading…
Reference in New Issue