Procházet zdrojové kódy

Restyles the toolbar button toggle state

j8
yanas před 8 roky
rodič
revize
0e9835dde2

+ 5
- 4
conference.js Zobrazit soubor

543
                 // if user didn't give access to mic or camera or doesn't have
543
                 // if user didn't give access to mic or camera or doesn't have
544
                 // them at all, we disable corresponding toolbar buttons
544
                 // them at all, we disable corresponding toolbar buttons
545
                 if (!tracks.find((t) => t.isAudioTrack())) {
545
                 if (!tracks.find((t) => t.isAudioTrack())) {
546
-                    APP.UI.disableMicrophoneButton();
546
+                    APP.UI.disableMicrophoneButton(true);
547
                 }
547
                 }
548
 
548
 
549
                 if (!tracks.find((t) => t.isVideoTrack())) {
549
                 if (!tracks.find((t) => t.isVideoTrack())) {
550
-                    APP.UI.disableCameraButton();
550
+                    APP.UI.disableCameraButton(true);
551
                 }
551
                 }
552
 
552
 
553
                 this._initDeviceList();
553
                 this._initDeviceList();
930
 
930
 
931
                 APP.UI.addLocalStream(stream);
931
                 APP.UI.addLocalStream(stream);
932
 
932
 
933
-                stream.videoType === 'camera' && APP.UI.enableCameraButton();
933
+                stream.videoType === 'camera'
934
+                && APP.UI.disableCameraButton(false);
934
             } else {
935
             } else {
935
                 this.videoMuted = false;
936
                 this.videoMuted = false;
936
                 this.isSharingScreen = false;
937
                 this.isSharingScreen = false;
970
                 this.audioMuted = false;
971
                 this.audioMuted = false;
971
             }
972
             }
972
 
973
 
973
-            APP.UI.enableMicrophoneButton();
974
+            APP.UI.disableMicrophoneButton(false);
974
             APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
975
             APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
975
         });
976
         });
976
     },
977
     },

+ 0
- 4
css/_base.scss Zobrazit soubor

81
     display: block;
81
     display: block;
82
 }
82
 }
83
 
83
 
84
-.active {
85
-    background-color: #00ccff;
86
-}
87
-
88
 .watermark {
84
 .watermark {
89
     display: block;
85
     display: block;
90
     position: absolute;
86
     position: absolute;

+ 3
- 4
css/_toolbars.scss Zobrazit soubor

42
     margin-left: auto;
42
     margin-left: auto;
43
     margin-right: auto;
43
     margin-right: auto;
44
     width: auto;
44
     width: auto;
45
-    border-radius: 4px;
45
+    border-radius: 3px;
46
 
46
 
47
     .first {
47
     .first {
48
         border-bottom-left-radius: 4px;
48
         border-bottom-left-radius: 4px;
111
     cursor: default;
111
     cursor: default;
112
 }
112
 }
113
 
113
 
114
-.button.glow
115
-{
116
-    text-shadow: 0px 0px 5px $toolbarToggleBackground;
114
+.button.toggled {
115
+    background: $toolbarToggleBackground !important;
117
 }
116
 }
118
 
117
 
119
 a.button.unclickable:hover,
118
 a.button.unclickable:hover,

+ 1
- 1
css/_variables.scss Zobrazit soubor

30
 
30
 
31
 $toolbarBadgeBackground: #165ECC;
31
 $toolbarBadgeBackground: #165ECC;
32
 $toolbarBadgeColor: #FFFFFF;
32
 $toolbarBadgeColor: #FFFFFF;
33
-$toolbarToggleBackground: #165ECC;
33
+$toolbarToggleBackground: #12499C;
34
 
34
 
35
 // Main controls
35
 // Main controls
36
 $inputBackground: rgba(132, 132, 132, .5);
36
 $inputBackground: rgba(132, 132, 132, .5);

+ 12
- 20
modules/UI/UI.js Zobrazit soubor

820
 UI.setAudioMuted = function (id, muted) {
820
 UI.setAudioMuted = function (id, muted) {
821
     VideoLayout.onAudioMute(id, muted);
821
     VideoLayout.onAudioMute(id, muted);
822
     if (APP.conference.isLocalId(id)) {
822
     if (APP.conference.isLocalId(id)) {
823
-        Toolbar.markAudioIconAsMuted(muted);
823
+        Toolbar.toggleAudioIcon(muted);
824
     }
824
     }
825
 };
825
 };
826
 
826
 
830
 UI.setVideoMuted = function (id, muted) {
830
 UI.setVideoMuted = function (id, muted) {
831
     VideoLayout.onVideoMute(id, muted);
831
     VideoLayout.onVideoMute(id, muted);
832
     if (APP.conference.isLocalId(id)) {
832
     if (APP.conference.isLocalId(id)) {
833
-        Toolbar.markVideoIconAsMuted(muted);
833
+        Toolbar.toggleVideoIcon(muted);
834
     }
834
     }
835
 };
835
 };
836
 
836
 
1460
 
1460
 
1461
 /**
1461
 /**
1462
  * Disables camera toolbar button.
1462
  * Disables camera toolbar button.
1463
+ *
1464
+ * @param {boolean} disable indicates if the camera button should be disabled
1465
+ * or enabled
1463
  */
1466
  */
1464
-UI.disableCameraButton = function () {
1465
-    Toolbar.markVideoIconAsDisabled(true);
1466
-};
1467
-
1468
-/**
1469
- * Enables camera toolbar button.
1470
- */
1471
-UI.enableCameraButton = function () {
1472
-    Toolbar.markVideoIconAsDisabled(false);
1467
+UI.disableCameraButton = function (disable) {
1468
+    Toolbar.disableVideoIcon(disable);
1473
 };
1469
 };
1474
 
1470
 
1475
 /**
1471
 /**
1476
  * Disables microphone toolbar button.
1472
  * Disables microphone toolbar button.
1473
+ *
1474
+ * @param {boolean} disable indicates if the microphone button should be
1475
+ * disabled or enabled
1477
  */
1476
  */
1478
-UI.disableMicrophoneButton = function () {
1479
-    Toolbar.markAudioIconAsDisabled(true);
1480
-};
1481
-
1482
-/**
1483
- * Enables microphone toolbar button.
1484
- */
1485
-UI.enableMicrophoneButton = function () {
1486
-    Toolbar.markAudioIconAsDisabled(false);
1477
+UI.disableMicrophoneButton = function (disable) {
1478
+    Toolbar.disableAudioIcon(disable);
1487
 };
1479
 };
1488
 
1480
 
1489
 UI.showRingOverLay = function () {
1481
 UI.showRingOverLay = function () {

+ 15
- 9
modules/UI/recording/Recording.js Zobrazit soubor

422
      * @param recordingState gives us the current recording state
422
      * @param recordingState gives us the current recording state
423
      */
423
      */
424
     updateRecordingUI (recordingState) {
424
     updateRecordingUI (recordingState) {
425
-        let buttonSelector = $('#toolbar_button_record');
426
 
425
 
427
         let oldState = this.currentState;
426
         let oldState = this.currentState;
428
         this.currentState = recordingState;
427
         this.currentState = recordingState;
431
         if (recordingState === Status.ON ||
430
         if (recordingState === Status.ON ||
432
             recordingState === Status.RETRYING) {
431
             recordingState === Status.RETRYING) {
433
 
432
 
434
-            buttonSelector.removeClass(this.baseClass);
435
-            buttonSelector.addClass(this.baseClass + " active");
433
+            this._setToolbarButtonToggled(true);
436
 
434
 
437
             this._updateStatusLabel(this.recordingOnKey, false);
435
             this._updateStatusLabel(this.recordingOnKey, false);
438
         }
436
         }
447
                 && !isStartingStatus(oldState))
445
                 && !isStartingStatus(oldState))
448
                 return;
446
                 return;
449
 
447
 
450
-            buttonSelector.removeClass(this.baseClass + " active");
451
-            buttonSelector.addClass(this.baseClass);
448
+            this._setToolbarButtonToggled(false);
452
 
449
 
453
             let messageKey;
450
             let messageKey;
454
             if (isStartingStatus(oldState))
451
             if (isStartingStatus(oldState))
464
         }
461
         }
465
         else if (recordingState === Status.PENDING) {
462
         else if (recordingState === Status.PENDING) {
466
 
463
 
467
-            buttonSelector.removeClass(this.baseClass + " active");
468
-            buttonSelector.addClass(this.baseClass);
464
+            this._setToolbarButtonToggled(false);
469
 
465
 
470
             this._updateStatusLabel(this.recordingPendingKey, true);
466
             this._updateStatusLabel(this.recordingPendingKey, true);
471
         }
467
         }
472
         else if (recordingState === Status.ERROR
468
         else if (recordingState === Status.ERROR
473
                     || recordingState === Status.FAILED) {
469
                     || recordingState === Status.FAILED) {
474
-            buttonSelector.removeClass(this.baseClass + " active");
475
-            buttonSelector.addClass(this.baseClass);
470
+
471
+            this._setToolbarButtonToggled(false);
476
 
472
 
477
             this._updateStatusLabel(this.recordingErrorKey, true);
473
             this._updateStatusLabel(this.recordingErrorKey, true);
478
         }
474
         }
513
 
509
 
514
         labelTextSelector.attr("data-i18n", textKey);
510
         labelTextSelector.attr("data-i18n", textKey);
515
         labelTextSelector.text(APP.translation.translateString(textKey));
511
         labelTextSelector.text(APP.translation.translateString(textKey));
512
+    },
513
+
514
+    /**
515
+     * Sets the toggled state of the recording toolbar button.
516
+     *
517
+     * @param {boolean} isToggled indicates if the button should be toggled
518
+     * or not
519
+     */
520
+    _setToolbarButtonToggled(isToggled) {
521
+        ("#toolbar_button_record").toggleClass("toggled", isToggled);
516
     }
522
     }
517
 };
523
 };
518
 
524
 

+ 28
- 22
modules/UI/toolbars/Toolbar.js Zobrazit soubor

413
         );
413
         );
414
 
414
 
415
         APP.UI.addListener(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
415
         APP.UI.addListener(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
416
-            function(containerId, isVisible) {
416
+            (containerId, isVisible) => {
417
                 Toolbar._handleSideToolbarContainerToggled( containerId,
417
                 Toolbar._handleSideToolbarContainerToggled( containerId,
418
                                                             isVisible);
418
                                                             isVisible);
419
             });
419
             });
420
 
420
 
421
         APP.UI.addListener(UIEvents.LOCAL_RAISE_HAND_CHANGED,
421
         APP.UI.addListener(UIEvents.LOCAL_RAISE_HAND_CHANGED,
422
-            function(isRaisedHand) {
423
-                Toolbar._toggleRaiseHand(isRaisedHand);
422
+            (isRaisedHand) => {
423
+                this._setToggledState("toolbar_button_raisehand", isRaisedHand);
424
             });
424
             });
425
 
425
 
426
         if(!APP.tokenData.isGuest) {
426
         if(!APP.tokenData.isGuest) {
582
      * streaming is active.
582
      * streaming is active.
583
      */
583
      */
584
     updateDesktopSharingButtonState () {
584
     updateDesktopSharingButtonState () {
585
-        let button = $("#toolbar_button_desktopsharing");
586
-        if (APP.conference.isSharingScreen) {
587
-            button.addClass("glow");
588
-        } else {
589
-            button.removeClass("glow");
590
-        }
591
-    },
592
-
593
-    /**
594
-     * Toggles / untoggles the view for raised hand.
595
-     */
596
-    _toggleRaiseHand(isRaisedHand) {
597
-        $('#toolbar_button_raisehand').toggleClass("glow", isRaisedHand);
585
+        this._setToggledState(  "toolbar_button_desktopsharing",
586
+                                APP.conference.isSharingScreen);
598
     },
587
     },
599
 
588
 
600
     /**
589
     /**
601
      * Marks video icon as muted or not.
590
      * Marks video icon as muted or not.
591
+     *
602
      * @param {boolean} muted if icon should look like muted or not
592
      * @param {boolean} muted if icon should look like muted or not
603
      */
593
      */
604
-    markVideoIconAsMuted (muted) {
594
+    toggleVideoIcon (muted) {
605
         $('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
595
         $('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
596
+
597
+        this._setToggledState("toolbar_button_camera", muted);
606
     },
598
     },
607
 
599
 
608
     /**
600
     /**
609
      * Marks video icon as disabled or not.
601
      * Marks video icon as disabled or not.
610
      * @param {boolean} disabled if icon should look like disabled or not
602
      * @param {boolean} disabled if icon should look like disabled or not
611
      */
603
      */
612
-    markVideoIconAsDisabled (disabled) {
604
+    disableVideoIcon (disabled) {
613
         var $btn = $('#toolbar_button_camera');
605
         var $btn = $('#toolbar_button_camera');
614
 
606
 
615
         $btn
607
         $btn
625
 
617
 
626
         APP.translation.translateElement($btn);
618
         APP.translation.translateElement($btn);
627
 
619
 
628
-        disabled && this.markVideoIconAsMuted(disabled);
620
+        disabled && this.toggleVideoIcon(disabled);
629
     },
621
     },
630
 
622
 
631
     /**
623
     /**
632
      * Marks audio icon as muted or not.
624
      * Marks audio icon as muted or not.
625
+     *
633
      * @param {boolean} muted if icon should look like muted or not
626
      * @param {boolean} muted if icon should look like muted or not
634
      */
627
      */
635
-    markAudioIconAsMuted (muted) {
628
+    toggleAudioIcon(muted) {
636
         $('#toolbar_button_mute').toggleClass("icon-microphone",
629
         $('#toolbar_button_mute').toggleClass("icon-microphone",
637
             !muted).toggleClass("icon-mic-disabled", muted);
630
             !muted).toggleClass("icon-mic-disabled", muted);
631
+
632
+        this._setToggledState("toolbar_button_mute", muted);
638
     },
633
     },
639
 
634
 
640
     /**
635
     /**
641
      * Marks audio icon as disabled or not.
636
      * Marks audio icon as disabled or not.
642
      * @param {boolean} disabled if icon should look like disabled or not
637
      * @param {boolean} disabled if icon should look like disabled or not
643
      */
638
      */
644
-    markAudioIconAsDisabled (disabled) {
639
+    disableAudioIcon (disabled) {
645
         var $btn = $('#toolbar_button_mute');
640
         var $btn = $('#toolbar_button_mute');
646
 
641
 
647
         $btn
642
         $btn
657
 
652
 
658
         APP.translation.translateElement($btn);
653
         APP.translation.translateElement($btn);
659
 
654
 
660
-        disabled && this.markAudioIconAsMuted(disabled);
655
+        disabled && this.toggleAudioIcon(disabled);
661
     },
656
     },
662
 
657
 
663
     /**
658
     /**
819
             popupElement.appendChild(liElement);
814
             popupElement.appendChild(liElement);
820
             buttonElement.appendChild(popupElement);
815
             buttonElement.appendChild(popupElement);
821
         });
816
         });
817
+    },
818
+
819
+    /**
820
+     * Sets the toggled state of the given element depending on the isToggled
821
+     * parameter.
822
+     *
823
+     * @param elementId the element identifier
824
+     * @param isToggled indicates if the element should be toggled or untoggled
825
+     */
826
+        _setToggledState(elementId, isToggled) {
827
+        $("#" + elementId).toggleClass("toggled", isToggled);
822
     }
828
     }
823
 };
829
 };
824
 
830
 

+ 2
- 2
modules/devices/mediaDeviceHelper.js Zobrazit soubor

58
         // Otherwise we assume that we don't have any audio input devices
58
         // Otherwise we assume that we don't have any audio input devices
59
         // to use and that's why disable microphone button on UI.
59
         // to use and that's why disable microphone button on UI.
60
         else {
60
         else {
61
-            APP.UI.disableMicrophoneButton();
61
+            APP.UI.disableMicrophoneButton(true);
62
         }
62
         }
63
     } else {
63
     } else {
64
         // And here we handle case when we already have some device working,
64
         // And here we handle case when we already have some device working,
100
         // Otherwise we assume that we don't have any video input devices
100
         // Otherwise we assume that we don't have any video input devices
101
         // to use and that's why disable microphone button on UI.
101
         // to use and that's why disable microphone button on UI.
102
         else {
102
         else {
103
-            APP.UI.disableCameraButton();
103
+            APP.UI.disableCameraButton(true);
104
         }
104
         }
105
     } else {
105
     } else {
106
         // And here we handle case when we already have some device working,
106
         // And here we handle case when we already have some device working,

Načítá se…
Zrušit
Uložit