diff --git a/advanced_ui_component/composelistitem/interfaces/composelistitem.js b/advanced_ui_component/composelistitem/interfaces/composelistitem.js index 76ad3abefa6..68b613243ad 100644 --- a/advanced_ui_component/composelistitem/interfaces/composelistitem.js +++ b/advanced_ui_component/composelistitem/interfaces/composelistitem.js @@ -789,14 +789,6 @@ class OperateItemStruct extends ViewPU { Button.onFocus(() => { this.parentCanFocus = false; }); - Button.onTouch((d1) => { - if (d1.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (d1.type === TouchType.Up || d1.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Button.onHover((c1) => { this.parentCanHover = false; if (c1 && this.parentFrontColor === this.hoveringColor) { @@ -837,14 +829,6 @@ class OperateItemStruct extends ViewPU { Button.onFocus(() => { this.parentCanFocus = false; }); - Button.onTouch((y6) => { - if (y6.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (y6.type === TouchType.Up || y6.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Button.onHover((x6) => { this.parentCanHover = false; if (x6 && this.parentFrontColor === this.hoveringColor) { @@ -895,7 +879,7 @@ class OperateItemStruct extends ViewPU { this.observeComponentCreation2((x5, y5) => { Button.createWithChild({ type: ButtonType.Normal }); Button.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); - Button.hitTestBehavior(HitTestMode.Transparent); + Button.hitTestBehavior(this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent); Button.backgroundColor(Color.Transparent); Button.height(OPERATEITEM_ICONLIKE_SIZE); Button.width(OPERATEITEM_ARROW_WIDTH); @@ -903,17 +887,6 @@ class OperateItemStruct extends ViewPU { this.parentCanFocus = false; }); Button.stateEffect(this.arrow?.action !== undefined); - Button.onTouch((d6) => { - if (this.arrow?.action === undefined) { - return; - } - if (d6.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (d6.type === TouchType.Up || d6.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); Button.onHover((c6) => { if (this.arrow?.action === undefined) { @@ -957,14 +930,6 @@ class OperateItemStruct extends ViewPU { this.parentCanFocus = false; }); Radio.hitTestBehavior(HitTestMode.Block); - Radio.onTouch((r5) => { - if (r5.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (r5.type === TouchType.Up || r5.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Radio.onHover((q5) => { this.parentCanHover = false; if (q5 && this.parentFrontColor === this.hoveringColor) { @@ -993,14 +958,6 @@ class OperateItemStruct extends ViewPU { this.parentCanFocus = false; }); Checkbox.hitTestBehavior(HitTestMode.Block); - Checkbox.onTouch((i5) => { - if (i5.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (i5.type === TouchType.Up || i5.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Checkbox.onHover((h5) => { this.parentCanHover = false; if (h5 && this.parentFrontColor === this.hoveringColor) { @@ -1027,14 +984,6 @@ class OperateItemStruct extends ViewPU { Row.onFocus(() => { this.parentCanFocus = false; }); - Row.onTouch((z4) => { - if (z4.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (z4.type === TouchType.Up || z4.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Row.onHover((y4) => { this.parentCanHover = false; if (y4 && this.parentFrontColor === this.hoveringColor) { @@ -1063,7 +1012,7 @@ class OperateItemStruct extends ViewPU { createTextArrow(v3 = null) { this.observeComponentCreation2((g4, h4) => { Button.createWithChild({ type: ButtonType.Normal }); - Button.hitTestBehavior(HitTestMode.Transparent); + Button.hitTestBehavior(this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent); Button.labelStyle({ maxLines: TEXT_MAX_LINE }); @@ -1080,17 +1029,6 @@ class OperateItemStruct extends ViewPU { right: 0 }); Button.stateEffect(this.arrow?.action !== undefined); - Button.onTouch((b1) => { - if (this.arrow?.action === undefined) { - return; - } - if (b1.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (b1.type === TouchType.Up || b1.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }); Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); Button.onHover((a1) => { if (this.arrow?.action === undefined) { @@ -1743,14 +1681,6 @@ export class ComposeListItem extends ViewPU { (this.isActive ? this.activedColor : Color.Transparent.toString()); } }); - Flex.onTouch((x1) => { - if (x1.type === TouchType.Down && this.canTouch) { - this.frontColor = this.touchDownColor; - } - if (x1.type === TouchType.Up || x1.type === TouchType.Cancel) { - this.frontColor = this.isActive ? this.activedColor : Color.Transparent.toString(); - } - }); ViewStackProcessor.visualState("focused"); Flex.border({ radius: { @@ -1776,6 +1706,8 @@ export class ComposeListItem extends ViewPU { width: ITEM_BORDER_SHOWN, color: Color.Transparent }); + ViewStackProcessor.visualState("pressed"); + Flex.backgroundColor(ObservedObject.GetRawObject(this.touchDownColor)); ViewStackProcessor.visualState(); Flex.padding(ObservedObject.GetRawObject(this.containerPadding)); }, Flex); @@ -1811,10 +1743,6 @@ export class ComposeListItem extends ViewPU { If.create(); if (this.contentItem !== null) { this.ifElseBranchUpdateFunction(0, () => { - this.observeComponentCreation2((o1, p1) => { - __Common__.create(); - __Common__.flexShrink(0); - }, __Common__); { this.observeComponentCreation2((d, o) => { if (o) { @@ -1861,7 +1789,6 @@ export class ComposeListItem extends ViewPU { } }, { name: "ContentItemStruct" }); } - __Common__.pop(); }); } else { diff --git a/advanced_ui_component/composelistitem/source/composelistitem.ets b/advanced_ui_component/composelistitem/source/composelistitem.ets index 3d993b9cca8..e219504413e 100644 --- a/advanced_ui_component/composelistitem/source/composelistitem.ets +++ b/advanced_ui_component/composelistitem/source/composelistitem.ets @@ -345,14 +345,6 @@ struct OperateItemStruct { .onFocus(() => { this.parentCanFocus = false; }) - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .onHover((isHover: boolean) => { this.parentCanHover = false if (isHover && this.parentFrontColor === this.hoveringColor) { @@ -386,14 +378,6 @@ struct OperateItemStruct { .onFocus(() => { this.parentCanFocus = false; }) - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .onHover((isHover: boolean) => { this.parentCanHover = false if (isHover && this.parentFrontColor === this.hoveringColor) { @@ -442,7 +426,7 @@ struct OperateItemStruct { .matchTextDirection(true) } .margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }) - .hitTestBehavior(HitTestMode.Transparent) + .hitTestBehavior(this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent) .backgroundColor(Color.Transparent) .height(OPERATEITEM_ICONLIKE_SIZE) .width(OPERATEITEM_ARROW_WIDTH) @@ -450,17 +434,6 @@ struct OperateItemStruct { this.parentCanFocus = false; }) .stateEffect(this.arrow?.action !== undefined) - .onTouch((event: TouchEvent) => { - if (this.arrow?.action === undefined) { - return; - } - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None) .onHover((isHover: boolean) => { if (this.arrow?.action === undefined) { @@ -494,14 +467,6 @@ struct OperateItemStruct { this.parentCanFocus = false; }) .hitTestBehavior(HitTestMode.Block) - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .onHover((isHover: boolean) => { this.parentCanHover = false if (isHover && this.parentFrontColor === this.hoveringColor) { @@ -530,14 +495,6 @@ struct OperateItemStruct { this.parentCanFocus = false; }) .hitTestBehavior(HitTestMode.Block) - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .onHover((isHover: boolean) => { this.parentCanHover = false if (isHover && this.parentFrontColor === this.hoveringColor) { @@ -570,14 +527,6 @@ struct OperateItemStruct { .onFocus(() => { this.parentCanFocus = false; }) - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .onHover((isHover: boolean) => { this.parentCanHover = false if (isHover && this.parentFrontColor === this.hoveringColor) { @@ -642,7 +591,7 @@ struct OperateItemStruct { }) } } - .hitTestBehavior(HitTestMode.Transparent) + .hitTestBehavior(this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent) .labelStyle({ maxLines: TEXT_MAX_LINE }) @@ -659,17 +608,6 @@ struct OperateItemStruct { right: 0 }) .stateEffect(this.arrow?.action !== undefined) - .onTouch((event: TouchEvent) => { - if (this.arrow?.action === undefined) { - return; - } - if (event.type === TouchType.Down) { - this.parentCanTouch = false; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.parentCanTouch = true; - } - }) .hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None) .onHover((isHover: boolean) => { if (this.arrow?.action === undefined) { @@ -952,7 +890,6 @@ export struct ComposeListItem { parentDirection: this.containerDirection, itemDirection: this.contentItemDirection, }) - .flexShrink(0) } if (this.operateItem !== null) { OperateItemStruct({ @@ -1002,14 +939,6 @@ export struct ComposeListItem { (this.isActive ? this.activedColor : Color.Transparent.toString()); } }) - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down && this.canTouch) { - this.frontColor = this.touchDownColor; - } - if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.frontColor = this.isActive ? this.activedColor : Color.Transparent.toString(); - } - }) .stateStyles({ focused: { .border({ @@ -1025,6 +954,9 @@ export struct ComposeListItem { width: ITEM_BORDER_SHOWN, color: Color.Transparent }) + }, + pressed: { + .backgroundColor(this.touchDownColor) } }).padding(this.containerPadding) } diff --git a/advanced_ui_component/filter/interfaces/filter.js b/advanced_ui_component/filter/interfaces/filter.js index 396d051c1a3..273da596f17 100644 --- a/advanced_ui_component/filter/interfaces/filter.js +++ b/advanced_ui_component/filter/interfaces/filter.js @@ -877,6 +877,7 @@ class MultiFilterRow extends ViewPU { 'moduleName': '__harDefaultModuleName__' }); Image.focusable(true); + Image.draggable(false); ViewStackProcessor.visualState('focused'); Image.border({ radius: { @@ -2622,6 +2623,7 @@ export class Filter extends ViewPU { 'moduleName': '__harDefaultModuleName__' }); Image.focusable(true); + Image.draggable(false); }, Image); Row.pop(); Row.pop(); diff --git a/advanced_ui_component/filter/source/filter.ets b/advanced_ui_component/filter/source/filter.ets index 143605af6d8..6230e179297 100644 --- a/advanced_ui_component/filter/source/filter.ets +++ b/advanced_ui_component/filter/source/filter.ets @@ -341,6 +341,7 @@ struct MultiFilterRow { .height(LIST_ROW_HEIGHT) .fillColor($r('sys.color.ohos_id_color_tertiary')) .focusable(true) + .draggable(false) .stateStyles({ focused: { .border({ @@ -1099,6 +1100,7 @@ export struct Filter { .height(ARROW_IMG_SIZE) .fillColor($r('sys.color.ohos_id_color_text_primary_activated')) .focusable(true) + .draggable(false) } .height(LIST_ROW_HEIGHT) .margin({ start: LengthMetrics.vp(FILTER_BAR_MARGIN) })