From 2b184a10d6f19e75d59f7f2b213862d7e324e2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 21 Jan 2020 10:32:59 +0100 Subject: [PATCH] util: Move wiggle parameters to a common place Since the wiggle effect will be used by the redesigned prompt-dialogs and we always want to use the same parameters, move those as defaults for the wiggle function to the util.js file. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/942 --- js/gdm/authPrompt.js | 10 +--------- js/misc/util.js | 10 +++++++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index ac42c2c96..4c0f8d23f 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -17,10 +17,6 @@ var DEFAULT_BUTTON_WELL_ANIMATION_TIME = 300; var MESSAGE_FADE_OUT_ANIMATION_TIME = 500; -const WIGGLE_OFFSET = 6; -const WIGGLE_DURATION = 65; -const N_WIGGLES = 3; - var AuthPromptMode = { UNLOCK_ONLY: 0, UNLOCK_OR_LOG_IN: 1, @@ -282,11 +278,7 @@ var AuthPrompt = GObject.registerClass({ this.setActorInDefaultButtonWell(null); this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED; - Util.wiggle(this._entry, { - offset: WIGGLE_OFFSET, - duration: WIGGLE_DURATION, - wiggleCount: N_WIGGLES, - }); + Util.wiggle(this._entry); } _onVerificationComplete() { diff --git a/js/misc/util.js b/js/misc/util.js index f143c9151..a58ebc5e8 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -11,6 +11,10 @@ const Params = imports.misc.params; var SCROLL_TIME = 100; +const WIGGLE_OFFSET = 6; +const WIGGLE_DURATION = 65; +const N_WIGGLES = 3; + // http://daringfireball.net/2010/07/improved_regex_for_matching_urls const _balancedParens = '\\([^\\s()<>]+\\)'; const _leadingJunk = '[\\s`(\\[{\'\\"<\u00AB\u201C\u2018]'; @@ -442,9 +446,9 @@ function ensureActorVisibleInScrollView(scrollView, actor) { function wiggle(actor, params) { params = Params.parse(params, { - offset: 0, - duration: 0, - wiggleCount: 0, + offset: WIGGLE_OFFSET, + duration: WIGGLE_DURATION, + wiggleCount: N_WIGGLES, }); actor.translation_x = 0;