Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 2561c87

Browse files
author
Narciso Jaramillo
committed
Merge pull request #4795 from adobe/larz/ui-transitions-squashed
Animate modal bar appearance/disappearance.
2 parents 7efcd76 + f3450c1 commit 2561c87

4 files changed

Lines changed: 40 additions & 12 deletions

File tree

src/styles/brackets.less

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ a, img {
9090
}
9191

9292
.main-view {
93+
background: @background-color-3; // to keep the theme background consistent
9394
height: 100%;
9495

9596
.sidebar {
@@ -215,7 +216,7 @@ a, img {
215216
left: 0;
216217
top: -1px;
217218
width: 6px;
218-
-webkit-transition: 0.1s linear all;
219+
transition: 0.1s linear all;
219220
}
220221

221222
#indent-width-input:focus {
@@ -567,8 +568,7 @@ a, img {
567568
-webkit-transform: translateZ(0);
568569
transform: translateZ(0);
569570

570-
-webkit-transition: height 0.125s ease-out;
571-
transition: height 0.125s ease-out;
571+
transition: height 250ms cubic-bezier(0, 1.02, 0.6, 1);
572572
}
573573

574574
.CodeMirror {
@@ -652,8 +652,7 @@ a, img {
652652
top: @top-margin;
653653

654654
&.animate {
655-
-webkit-transition: height 0.1s ease-out;
656-
-webkit-transition: top 0.1s ease-out;
655+
transition: top 0.1s ease-out;
657656
}
658657
}
659658

@@ -699,7 +698,7 @@ a, img {
699698

700699
.selected {
701700
color: @inline-color-3;
702-
-webkit-transition: color 0.1s ease-out .15s;
701+
transition: color 0.1s ease-out .15s;
703702
}
704703
}
705704
}
@@ -774,17 +773,38 @@ a, img {
774773

775774
/* Modal bar for Find/Quick Open */
776775

776+
.modal-bar.hide {
777+
position: absolute;
778+
left: 0;
779+
right: 0;
780+
top: 0;
781+
-webkit-transform: translate(0, -44px);
782+
transform: translate(0, -44px);
783+
transition: -webkit-transform 266ms cubic-bezier(0, 0.56, 0, 1);
784+
transition: transform 266ms cubic-bezier(0, 0.56, 0, 1);
785+
786+
body:not(.has-appshell-menus) & {
787+
top: 37px;
788+
}
789+
}
790+
777791
.modal-bar {
792+
display: block;
778793
text-align: left;
779794

780795
font-family: @sansFontFamily;
781796
font-size: 14px;
782797
color: @tc-text;
783798
background: @tc-gray-panel;
799+
overflow: hidden;
784800
padding: 5px 4px 4px 14px;
785-
overflow: hidden;
786801

787-
body.in-browser & {
802+
-webkit-transform: translate(0, 0); // Prefix still required.
803+
transition: -webkit-transform 66ms cubic-bezier(0, 0.62, 0.04, 0.99);
804+
z-index: @z-index-brackets-modalbar;
805+
806+
body.in-browser &,
807+
body:not(.has-appshell-menus) & {
788808
// Separator line between us and the HTML menu/titlebar above
789809
border-top: 1px solid darken(@background-color-3, @bc-color-step-size);
790810
}

src/styles/brackets_variables.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
@z-index-brackets-inline-editor-shadow: @z-index-brackets-ui;
5050
@z-index-brackets-toolbar: @z-index-brackets-ui;
5151
@z-index-brackets-max: @z-index-brackets-toolbar;
52+
@z-index-brackets-modalbar: @z-index-brackets-toolbar - 1;
5253

5354
@z-index-brackets-sidebar-resizer: @z-index-brackets-ui + 2;
5455
@z-index-brackets-resizer-div: @z-index-brackets-sidebar-resizer + 1;

src/view/PanelManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ define(function (require, exports, module) {
6464

6565
$editorHolder.siblings().each(function (i, elem) {
6666
var $elem = $(elem);
67-
if ($elem.css("display") !== "none") {
67+
if ($elem.css("display") !== "none" && $elem.css("position") !== "absolute") {
6868
availableHt -= $elem.outerHeight();
6969
}
7070
});

src/widgets/ModalBar.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ define(function (require, exports, module) {
4949
this._handleInputKeydown = this._handleInputKeydown.bind(this);
5050
this._handleFocusChange = this._handleFocusChange.bind(this);
5151

52-
this._$root = $("<div class='modal-bar'/>")
52+
this._$root = $("<div class='modal-bar hide'/>")
5353
.html(template)
5454
.insertBefore("#editor-holder");
55+
56+
// Forcing the renderer to do a layout, which will cause it to apply the transform for the "hide" class, so it will animate when you remove the class.
57+
window.getComputedStyle(this._$root.get(0)).getPropertyValue("top");
58+
this._$root.removeClass("hide");
5559

5660
// If something *other* than an editor (like another modal bar) has focus, set the focus
5761
// to the editor here, before opening up the new modal bar. This ensures that the old
@@ -123,8 +127,11 @@ define(function (require, exports, module) {
123127
window.document.body.removeEventListener("focusin", this._handleFocusChange, true);
124128
}
125129

126-
this._$root.remove();
127-
130+
var self = this;
131+
this._$root.addClass("hide").one("webkitTransitionEnd", function () {
132+
self._$root.remove();
133+
});
134+
128135
// Preserve scroll position of the current full editor across the editor refresh, adjusting for the
129136
// height of the modal bar so the code doesn't appear to shift if possible.
130137
var fullEditor = EditorManager.getCurrentFullEditor(),

0 commit comments

Comments
 (0)