mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 21:58:13 +00:00
[General] remove dupe, debounce inputs
Remove duplicate ClickAwayController implementation that was obscuring actual implementation. Debounce clickaway action in case toggle is invoked in a click handler. Resolves https://github.com/nasa/openmct/issues/888
This commit is contained in:
@ -19,7 +19,7 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -36,20 +36,19 @@ define(
|
||||
* @param $scope the scope in which this controller is active
|
||||
* @param $document the document element, injected by Angular
|
||||
*/
|
||||
function ClickAwayController($scope, $document) {
|
||||
function ClickAwayController($document, $timeout) {
|
||||
var self = this;
|
||||
|
||||
this.state = false;
|
||||
this.$scope = $scope;
|
||||
this.$document = $document;
|
||||
|
||||
// Callback used by the document listener. Deactivates;
|
||||
// note also $scope.$apply is invoked to indicate that
|
||||
// the state of this controller has changed.
|
||||
// Callback used by the document listener. Timeout ensures that
|
||||
// `clickaway` action occurs after `toggle` if `toggle` is
|
||||
// triggered by a click/mouseup.
|
||||
this.clickaway = function () {
|
||||
self.deactivate();
|
||||
$scope.$apply();
|
||||
return false;
|
||||
$timeout(function () {
|
||||
self.deactivate();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user