Browse Source

Restyles the toolbar button toggle state

j8
yanas 8 years ago
parent
commit
0e9835dde2

+ 5
- 4
conference.js View File

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

+ 0
- 4
css/_base.scss View File

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

+ 3
- 4
css/_toolbars.scss View File

@@ -42,7 +42,7 @@
42 42
     margin-left: auto;
43 43
     margin-right: auto;
44 44
     width: auto;
45
-    border-radius: 4px;
45
+    border-radius: 3px;
46 46
 
47 47
     .first {
48 48
         border-bottom-left-radius: 4px;
@@ -111,9 +111,8 @@
111 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 118
 a.button.unclickable:hover,

+ 1
- 1
css/_variables.scss View File

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

+ 12
- 20
modules/UI/UI.js View File

@@ -820,7 +820,7 @@ UI.askForNickname = function () {
820 820
 UI.setAudioMuted = function (id, muted) {
821 821
     VideoLayout.onAudioMute(id, muted);
822 822
     if (APP.conference.isLocalId(id)) {
823
-        Toolbar.markAudioIconAsMuted(muted);
823
+        Toolbar.toggleAudioIcon(muted);
824 824
     }
825 825
 };
826 826
 
@@ -830,7 +830,7 @@ UI.setAudioMuted = function (id, muted) {
830 830
 UI.setVideoMuted = function (id, muted) {
831 831
     VideoLayout.onVideoMute(id, muted);
832 832
     if (APP.conference.isLocalId(id)) {
833
-        Toolbar.markVideoIconAsMuted(muted);
833
+        Toolbar.toggleVideoIcon(muted);
834 834
     }
835 835
 };
836 836
 
@@ -1460,30 +1460,22 @@ UI.onSharedVideoStop = function (id, attributes) {
1460 1460
 
1461 1461
 /**
1462 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 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 1481
 UI.showRingOverLay = function () {

+ 15
- 9
modules/UI/recording/Recording.js View File

@@ -422,7 +422,6 @@ var Recording = {
422 422
      * @param recordingState gives us the current recording state
423 423
      */
424 424
     updateRecordingUI (recordingState) {
425
-        let buttonSelector = $('#toolbar_button_record');
426 425
 
427 426
         let oldState = this.currentState;
428 427
         this.currentState = recordingState;
@@ -431,8 +430,7 @@ var Recording = {
431 430
         if (recordingState === Status.ON ||
432 431
             recordingState === Status.RETRYING) {
433 432
 
434
-            buttonSelector.removeClass(this.baseClass);
435
-            buttonSelector.addClass(this.baseClass + " active");
433
+            this._setToolbarButtonToggled(true);
436 434
 
437 435
             this._updateStatusLabel(this.recordingOnKey, false);
438 436
         }
@@ -447,8 +445,7 @@ var Recording = {
447 445
                 && !isStartingStatus(oldState))
448 446
                 return;
449 447
 
450
-            buttonSelector.removeClass(this.baseClass + " active");
451
-            buttonSelector.addClass(this.baseClass);
448
+            this._setToolbarButtonToggled(false);
452 449
 
453 450
             let messageKey;
454 451
             if (isStartingStatus(oldState))
@@ -464,15 +461,14 @@ var Recording = {
464 461
         }
465 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 466
             this._updateStatusLabel(this.recordingPendingKey, true);
471 467
         }
472 468
         else if (recordingState === Status.ERROR
473 469
                     || recordingState === Status.FAILED) {
474
-            buttonSelector.removeClass(this.baseClass + " active");
475
-            buttonSelector.addClass(this.baseClass);
470
+
471
+            this._setToolbarButtonToggled(false);
476 472
 
477 473
             this._updateStatusLabel(this.recordingErrorKey, true);
478 474
         }
@@ -513,6 +509,16 @@ var Recording = {
513 509
 
514 510
         labelTextSelector.attr("data-i18n", textKey);
515 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 View File

@@ -413,14 +413,14 @@ const Toolbar = {
413 413
         );
414 414
 
415 415
         APP.UI.addListener(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
416
-            function(containerId, isVisible) {
416
+            (containerId, isVisible) => {
417 417
                 Toolbar._handleSideToolbarContainerToggled( containerId,
418 418
                                                             isVisible);
419 419
             });
420 420
 
421 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 426
         if(!APP.tokenData.isGuest) {
@@ -582,34 +582,26 @@ const Toolbar = {
582 582
      * streaming is active.
583 583
      */
584 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 590
      * Marks video icon as muted or not.
591
+     *
602 592
      * @param {boolean} muted if icon should look like muted or not
603 593
      */
604
-    markVideoIconAsMuted (muted) {
594
+    toggleVideoIcon (muted) {
605 595
         $('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
596
+
597
+        this._setToggledState("toolbar_button_camera", muted);
606 598
     },
607 599
 
608 600
     /**
609 601
      * Marks video icon as disabled or not.
610 602
      * @param {boolean} disabled if icon should look like disabled or not
611 603
      */
612
-    markVideoIconAsDisabled (disabled) {
604
+    disableVideoIcon (disabled) {
613 605
         var $btn = $('#toolbar_button_camera');
614 606
 
615 607
         $btn
@@ -625,23 +617,26 @@ const Toolbar = {
625 617
 
626 618
         APP.translation.translateElement($btn);
627 619
 
628
-        disabled && this.markVideoIconAsMuted(disabled);
620
+        disabled && this.toggleVideoIcon(disabled);
629 621
     },
630 622
 
631 623
     /**
632 624
      * Marks audio icon as muted or not.
625
+     *
633 626
      * @param {boolean} muted if icon should look like muted or not
634 627
      */
635
-    markAudioIconAsMuted (muted) {
628
+    toggleAudioIcon(muted) {
636 629
         $('#toolbar_button_mute').toggleClass("icon-microphone",
637 630
             !muted).toggleClass("icon-mic-disabled", muted);
631
+
632
+        this._setToggledState("toolbar_button_mute", muted);
638 633
     },
639 634
 
640 635
     /**
641 636
      * Marks audio icon as disabled or not.
642 637
      * @param {boolean} disabled if icon should look like disabled or not
643 638
      */
644
-    markAudioIconAsDisabled (disabled) {
639
+    disableAudioIcon (disabled) {
645 640
         var $btn = $('#toolbar_button_mute');
646 641
 
647 642
         $btn
@@ -657,7 +652,7 @@ const Toolbar = {
657 652
 
658 653
         APP.translation.translateElement($btn);
659 654
 
660
-        disabled && this.markAudioIconAsMuted(disabled);
655
+        disabled && this.toggleAudioIcon(disabled);
661 656
     },
662 657
 
663 658
     /**
@@ -819,6 +814,17 @@ const Toolbar = {
819 814
             popupElement.appendChild(liElement);
820 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 View File

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

Loading…
Cancel
Save