瀏覽代碼

Add shortcut key for toggle tile view (#4882)

* Add shortcut key for toggle tile view

* Toggle tile view shortcut - undo main-enGB.json

* Add analytics

* Use already defined toolbar translations
j8
theunafraid 5 年之前
父節點
當前提交
fb3a832a52
共有 1 個文件被更改,包括 44 次插入1 次删除
  1. 44
    1
      react/features/toolbox/components/web/Toolbox.js

+ 44
- 1
react/features/toolbox/components/web/Toolbox.js 查看文件

@@ -57,7 +57,10 @@ import {
57 57
 } from '../../../settings';
58 58
 import { toggleSharedVideo } from '../../../shared-video';
59 59
 import { SpeakerStats } from '../../../speaker-stats';
60
-import { TileViewButton } from '../../../video-layout';
60
+import {
61
+    TileViewButton,
62
+    toggleTileView
63
+} from '../../../video-layout';
61 64
 import {
62 65
     OverflowMenuVideoQualityItem,
63 66
     VideoQualityDialog
@@ -122,6 +125,11 @@ type Props = {
122 125
      */
123 126
     _fullScreen: boolean,
124 127
 
128
+    /**
129
+     * Whether or not the tile view is enabled.
130
+     */
131
+    _tileViewEnabled: boolean,
132
+
125 133
     /**
126 134
      * Whether or not invite should be hidden, regardless of feature
127 135
      * availability.
@@ -236,6 +244,7 @@ class Toolbox extends Component<Props, State> {
236 244
         this._onToolbarToggleScreenshare = this._onToolbarToggleScreenshare.bind(this);
237 245
         this._onToolbarToggleSharedVideo = this._onToolbarToggleSharedVideo.bind(this);
238 246
         this._onToolbarOpenLocalRecordingInfoDialog = this._onToolbarOpenLocalRecordingInfoDialog.bind(this);
247
+        this._onShortcutToggleTileView = this._onShortcutToggleTileView.bind(this);
239 248
 
240 249
         this.state = {
241 250
             windowWidth: window.innerWidth
@@ -274,6 +283,11 @@ class Toolbox extends Component<Props, State> {
274 283
                 character: 'S',
275 284
                 exec: this._onShortcutToggleFullScreen,
276 285
                 helpDescription: 'keyboardShortcuts.fullScreen'
286
+            },
287
+            this._shouldShowButton('tileview') && {
288
+                character: 'W',
289
+                exec: this._onShortcutToggleTileView,
290
+                helpDescription: 'toolbar.tileViewToggle'
277 291
             }
278 292
         ];
279 293
 
@@ -475,6 +489,16 @@ class Toolbox extends Component<Props, State> {
475 489
         this.props.dispatch(toggleDialog(VideoQualityDialog));
476 490
     }
477 491
 
492
+    /**
493
+     * Dispaches an action to toggle tile view.
494
+     *
495
+     * @private
496
+     * @returns {void}
497
+     */
498
+    _doToggleTileView() {
499
+        this.props.dispatch(toggleTileView());
500
+    }
501
+
478 502
     _onMouseOut: () => void;
479 503
 
480 504
     /**
@@ -565,6 +589,24 @@ class Toolbox extends Component<Props, State> {
565 589
         this._doToggleVideoQuality();
566 590
     }
567 591
 
592
+    _onShortcutToggleTileView: () => void;
593
+
594
+    /**
595
+     * Dispatches an action for toggling the tile view.
596
+     *
597
+     * @private
598
+     * @returns {void}
599
+     */
600
+    _onShortcutToggleTileView() {
601
+        sendAnalytics(createShortcutEvent(
602
+            'toggle.tileview',
603
+            {
604
+                enable: !this.props._tileViewEnabled
605
+            }));
606
+
607
+        this._doToggleTileView();
608
+    }
609
+
568 610
     _onShortcutToggleFullScreen: () => void;
569 611
 
570 612
     /**
@@ -1295,6 +1337,7 @@ function _mapStateToProps(state) {
1295 1337
             iAmRecorder || (!addPeopleEnabled && !dialOutEnabled),
1296 1338
         _isGuest: state['features/base/jwt'].isGuest,
1297 1339
         _fullScreen: fullScreen,
1340
+        _tileViewEnabled: state['features/video-layout'].tileViewEnabled,
1298 1341
         _localParticipantID: localParticipant.id,
1299 1342
         _localRecState: localRecordingStates,
1300 1343
         _overflowMenuVisible: overflowMenuVisible,

Loading…
取消
儲存