瀏覽代碼

fix(Thumbnail, Drawer): Remove hover state; Prevent outside propagation

master
Mihai-Andrei Uscat 3 年之前
父節點
當前提交
b7ab3ea052
共有 3 個文件被更改,包括 74 次插入41 次删除
  1. 13
    1
      css/_drawer.scss
  2. 38
    19
      react/features/filmstrip/components/web/Thumbnail.js
  3. 23
    21
      react/features/toolbox/components/web/Drawer.js

+ 13
- 1
css/_drawer.scss 查看文件

4
     right: 0;
4
     right: 0;
5
     bottom: 0;
5
     bottom: 0;
6
     z-index: $drawerZ;
6
     z-index: $drawerZ;
7
-    background-color: #141414;
8
     border-radius: 16px 16px 0 0;
7
     border-radius: 16px 16px 0 0;
9
 }
8
 }
10
 
9
 
10
+.drawer-portal::after {
11
+    content: '';
12
+    background-color: $participantsPaneBgColor;
13
+    margin-bottom: env(safe-area-inset-bottom, 0);
14
+}
15
+
16
+.drawer-menu-container {
17
+    height: 100vh;
18
+    display: flex;
19
+    align-items: flex-end;
20
+}
21
+
11
 .drawer-menu {
22
 .drawer-menu {
12
     max-height: calc(80vh - 64px);
23
     max-height: calc(80vh - 64px);
13
     background: #242528;
24
     background: #242528;
14
     border-radius: 16px 16px 0 0;
25
     border-radius: 16px 16px 0 0;
15
     overflow-y: hidden;
26
     overflow-y: hidden;
16
     margin-bottom: env(safe-area-inset-bottom, 0);
27
     margin-bottom: env(safe-area-inset-bottom, 0);
28
+    width: 100%;
17
 
29
 
18
     .drawer-toggle {
30
     .drawer-toggle {
19
         display: flex;
31
         display: flex;

+ 38
- 19
react/features/filmstrip/components/web/Thumbnail.js 查看文件

2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
 
4
 
5
-import { isMobileBrowser } from '../../../../../react/features/base/environment/utils';
6
 import { createScreenSharingIssueEvent, sendAnalytics } from '../../../analytics';
5
 import { createScreenSharingIssueEvent, sendAnalytics } from '../../../analytics';
7
 import { AudioLevelIndicator } from '../../../audio-level-indicator';
6
 import { AudioLevelIndicator } from '../../../audio-level-indicator';
8
 import { Avatar } from '../../../base/avatar';
7
 import { Avatar } from '../../../base/avatar';
8
+import { isMobileBrowser } from '../../../base/environment/utils';
9
 import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
9
 import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
10
 import { MEDIA_TYPE, VideoTrack } from '../../../base/media';
10
 import { MEDIA_TYPE, VideoTrack } from '../../../base/media';
11
 import {
11
 import {
139
      */
139
      */
140
     _isCurrentlyOnLargeVideo: boolean,
140
     _isCurrentlyOnLargeVideo: boolean,
141
 
141
 
142
+    /**
143
+     * Whether we are currently running in a mobile browser.
144
+     */
145
+    _isMobile: boolean,
146
+
142
     /**
147
     /**
143
      * Indicates whether the participant is screen sharing.
148
      * Indicates whether the participant is screen sharing.
144
      */
149
      */
612
      * @returns {ReactElement}
617
      * @returns {ReactElement}
613
      */
618
      */
614
     _renderFakeParticipant() {
619
     _renderFakeParticipant() {
615
-        const { _participant: { avatarURL } } = this.props;
620
+        const { _isMobile, _participant: { avatarURL } } = this.props;
616
         const styles = this._getStyles();
621
         const styles = this._getStyles();
617
         const containerClassName = this._getContainerClassName();
622
         const containerClassName = this._getContainerClassName();
618
 
623
 
621
                 className = { containerClassName }
626
                 className = { containerClassName }
622
                 id = 'sharedVideoContainer'
627
                 id = 'sharedVideoContainer'
623
                 onClick = { this._onClick }
628
                 onClick = { this._onClick }
624
-                onMouseEnter = { this._onMouseEnter }
625
-                onMouseLeave = { this._onMouseLeave }
629
+                { ...(_isMobile ? {} : {
630
+                    onMouseEnter: this._onMouseEnter,
631
+                    onMouseLeave: this._onMouseLeave
632
+                }) }
626
                 style = { styles.thumbnail }>
633
                 style = { styles.thumbnail }>
627
                 {avatarURL ? (
634
                 {avatarURL ? (
628
                     <img
635
                     <img
753
         const {
760
         const {
754
             _defaultLocalDisplayName,
761
             _defaultLocalDisplayName,
755
             _disableLocalVideoFlip,
762
             _disableLocalVideoFlip,
763
+            _isMobile,
756
             _isScreenSharing,
764
             _isScreenSharing,
757
             _localFlipX,
765
             _localFlipX,
758
             _disableProfile,
766
             _disableProfile,
772
                 className = { containerClassName }
780
                 className = { containerClassName }
773
                 id = 'localVideoContainer'
781
                 id = 'localVideoContainer'
774
                 onClick = { this._onClick }
782
                 onClick = { this._onClick }
775
-                onMouseEnter = { this._onMouseEnter }
776
-                onMouseLeave = { this._onMouseLeave }
777
-                { ...(isMobileBrowser() ? {
778
-                    onTouchEnd: this._onTouchEnd,
779
-                    onTouchMove: this._onTouchMove,
780
-                    onTouchStart: this._onTouchStart
781
-                } : {}) }
783
+                { ...(_isMobile
784
+                    ? {
785
+                        onTouchEnd: this._onTouchEnd,
786
+                        onTouchMove: this._onTouchMove,
787
+                        onTouchStart: this._onTouchStart
788
+                    }
789
+                    : {
790
+                        onMouseEnter: this._onMouseEnter,
791
+                        onMouseLeave: this._onMouseLeave
792
+                    }
793
+                ) }
782
                 style = { styles.thumbnail }>
794
                 style = { styles.thumbnail }>
783
                 <div className = 'videocontainer__background' />
795
                 <div className = 'videocontainer__background' />
784
                 <span id = 'localVideoWrapper'>
796
                 <span id = 'localVideoWrapper'>
875
      */
887
      */
876
     _renderRemoteParticipant() {
888
     _renderRemoteParticipant() {
877
         const {
889
         const {
890
+            _isMobile,
878
             _isTestModeEnabled,
891
             _isTestModeEnabled,
879
             _participant,
892
             _participant,
880
             _startSilent,
893
             _startSilent,
909
                 className = { containerClassName }
922
                 className = { containerClassName }
910
                 id = { `participant_${id}` }
923
                 id = { `participant_${id}` }
911
                 onClick = { this._onClick }
924
                 onClick = { this._onClick }
912
-                onMouseEnter = { this._onMouseEnter }
913
-                onMouseLeave = { this._onMouseLeave }
914
-                { ...(isMobileBrowser() ? {
915
-                    onTouchEnd: this._onTouchEnd,
916
-                    onTouchMove: this._onTouchMove,
917
-                    onTouchStart: this._onTouchStart
918
-                } : {}) }
925
+                { ...(_isMobile
926
+                    ? {
927
+                        onTouchEnd: this._onTouchEnd,
928
+                        onTouchMove: this._onTouchMove,
929
+                        onTouchStart: this._onTouchStart
930
+                    }
931
+                    : {
932
+                        onMouseEnter: this._onMouseEnter,
933
+                        onMouseLeave: this._onMouseLeave
934
+                    }
935
+                ) }
919
                 style = { styles.thumbnail }>
936
                 style = { styles.thumbnail }>
920
                 {
937
                 {
921
                     _videoTrack && <VideoTrack
938
                     _videoTrack && <VideoTrack
1031
     } = state['features/base/config'];
1048
     } = state['features/base/config'];
1032
     const { NORMAL = 8 } = interfaceConfig.INDICATOR_FONT_SIZES || {};
1049
     const { NORMAL = 8 } = interfaceConfig.INDICATOR_FONT_SIZES || {};
1033
     const { localFlipX } = state['features/base/settings'];
1050
     const { localFlipX } = state['features/base/settings'];
1051
+    const _isMobile = isMobileBrowser();
1034
 
1052
 
1035
 
1053
 
1036
     switch (_currentLayout) {
1054
     switch (_currentLayout) {
1072
     return {
1090
     return {
1073
         _audioTrack,
1091
         _audioTrack,
1074
         _connectionIndicatorAutoHideEnabled: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
1092
         _connectionIndicatorAutoHideEnabled: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED,
1075
-        _connectionIndicatorDisabled: isMobileBrowser() || interfaceConfig.CONNECTION_INDICATOR_DISABLED,
1093
+        _connectionIndicatorDisabled: _isMobile || interfaceConfig.CONNECTION_INDICATOR_DISABLED,
1076
         _currentLayout,
1094
         _currentLayout,
1077
         _defaultLocalDisplayName: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,
1095
         _defaultLocalDisplayName: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,
1078
         _disableLocalVideoFlip: Boolean(disableLocalVideoFlip),
1096
         _disableLocalVideoFlip: Boolean(disableLocalVideoFlip),
1081
         _isAudioOnly: Boolean(state['features/base/audio-only'].enabled),
1099
         _isAudioOnly: Boolean(state['features/base/audio-only'].enabled),
1082
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,
1100
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,
1083
         _isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
1101
         _isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
1102
+        _isMobile,
1084
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1103
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1085
         _isTestModeEnabled: isTestModeEnabled(state),
1104
         _isTestModeEnabled: isTestModeEnabled(state),
1086
         _isVideoPlayable: id && isVideoPlayable(state, id),
1105
         _isVideoPlayable: id && isVideoPlayable(state, id),

+ 23
- 21
react/features/toolbox/components/web/Drawer.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
-import React, { useEffect, useRef } from 'react';
3
+import React, { useCallback } from 'react';
4
 
4
 
5
 
5
 
6
 type Props = {
6
 type Props = {
30
     children,
30
     children,
31
     isOpen,
31
     isOpen,
32
     onClose }: Props) {
32
     onClose }: Props) {
33
-    const drawerRef: Object = useRef(null);
34
 
33
 
35
     /**
34
     /**
36
-     * Closes the drawer when clicking or touching outside of it.
35
+     * Handles clicks within the menu, preventing the propagation of the click event.
37
      *
36
      *
38
-     * @param {Event} event - Mouse down/start touch event object.
37
+     * @param {Object} event - The click event.
39
      * @returns {void}
38
      * @returns {void}
40
      */
39
      */
41
-    function handleOutsideClickOrTouch(event: Event) {
42
-        if (drawerRef.current && !drawerRef.current.contains(event.target)) {
43
-            onClose();
44
-        }
45
-    }
40
+    const handleInsideClick = useCallback(event => {
41
+        event.stopPropagation();
42
+    }, []);
46
 
43
 
47
-    useEffect(() => {
48
-        window.addEventListener('mousedown', handleOutsideClickOrTouch);
49
-        window.addEventListener('touchstart', handleOutsideClickOrTouch);
50
-
51
-        return () => {
52
-            window.removeEventListener('mousedown', handleOutsideClickOrTouch);
53
-            window.removeEventListener('touchstart', handleOutsideClickOrTouch);
54
-        };
55
-    }, [ drawerRef ]);
44
+    /**
45
+     * Handles clicks outside of the menu, closing it, and also stopping further propagation.
46
+     *
47
+     * @param {Object} event - The click event.
48
+     * @returns {void}
49
+     */
50
+    const handleOutsideClick = useCallback(event => {
51
+        event.stopPropagation();
52
+        onClose();
53
+    }, [ onClose ]);
56
 
54
 
57
     return (
55
     return (
58
         isOpen ? (
56
         isOpen ? (
59
             <div
57
             <div
60
-                className = 'drawer-menu'
61
-                ref = { drawerRef }>
62
-                {children}
58
+                className = 'drawer-menu-container'
59
+                onClick = { handleOutsideClick }>
60
+                <div
61
+                    className = 'drawer-menu'
62
+                    onClick = { handleInsideClick }>
63
+                    {children}
64
+                </div>
63
             </div>
65
             </div>
64
         ) : null
66
         ) : null
65
     );
67
     );

Loading…
取消
儲存