From ccdca49d8556a9061070462b65b38ea2fcaa4dd7 Mon Sep 17 00:00:00 2001 From: liatvi Date: Thu, 25 Apr 2024 13:15:39 +0300 Subject: [PATCH] force video play action on mobile to be click (#1211) * force video play action on mobile to be click * move logic to itemview * act the same loggic if hover on mocile * trigger hover when without overlay and no action --- packages/gallery/src/components/item/itemView.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/gallery/src/components/item/itemView.js b/packages/gallery/src/components/item/itemView.js index ebcd39920..cdc06a9b1 100644 --- a/packages/gallery/src/components/item/itemView.js +++ b/packages/gallery/src/components/item/itemView.js @@ -60,6 +60,7 @@ class ItemView extends React.Component { this.onFocus = this.onFocus.bind(this); this.onBlur = this.onBlur.bind(this); this.checkIfCurrentHoverChanged = this.checkIfCurrentHoverChanged.bind(this); + this.shouldHoverWithoutOverlayAndClickOnMobile = this.shouldHoverWithoutOverlayAndClickOnMobile.bind(this); } //----------------------------------------| ACTIONS |-------------------------------------------// @@ -142,6 +143,8 @@ class ItemView extends React.Component { if (this.shouldShowHoverOnMobile() || this.shouldShowSecondMediaOnMobile()) { this.handleHoverClickOnMobile(e); + } else if (this.shouldHoverWithoutOverlayAndClickOnMobile()) { + this.props.actions.eventsListener(GALLERY_CONSTS.events.HOVER_SET, this.props.idx); } else { this.handleGalleryItemAction(e); } @@ -257,6 +260,16 @@ class ItemView extends React.Component { return false; } + shouldHoverWithoutOverlayAndClickOnMobile() { + return ( + utils.isMobile() && + this.props.options[optionsMap.behaviourParams.item.video.playTrigger] === + GALLERY_CONSTS[optionsMap.behaviourParams.item.video.playTrigger].HOVER && + this.props.options[optionsMap.behaviourParams.item.clickAction] === + GALLERY_CONSTS[optionsMap.behaviourParams.item.clickAction].NOTHING + ); + } + isHighlight() { return this.props.thumbnailHighlightId && this.props.thumbnailHighlightId === this.props.id; }