docks.less 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. @import 'ui-variables';
  2. @import 'syntax-variables';
  3. @atom-dock-toggle-button-size: 50px;
  4. @atom-dock-resize-handle-size: 4px;
  5. // Dock --------------
  6. // The actual dock element is used as a kind of placeholder in the DOM, relative
  7. // to which its children can be positioned.
  8. atom-dock {
  9. display: flex;
  10. position: relative;
  11. }
  12. .atom-dock-inner {
  13. display: flex;
  14. &.bottom { width: 100%; }
  15. &.left, &.right { height: 100%; }
  16. // Make sure to center the toggle buttons
  17. &.bottom { flex-direction: column; }
  18. align-items: center;
  19. // Position the docks flush with their side of the editor.
  20. &.right { right: 0; }
  21. &.bottom { bottom: 0; }
  22. &.left { left: 0; }
  23. // Position the docks flush with their side of the editor.
  24. &.right { right: 0; }
  25. &.bottom { bottom: 0; }
  26. &.left { left: 0; }
  27. &:not(.atom-dock-open) {
  28. // The dock should only take up space when it's active (i.e. it shouldn't
  29. // take up space when you're dragging something into it).
  30. position: absolute;
  31. z-index: 10; // An arbitrary number. Seems high enough. ¯\_(ツ)_/¯
  32. }
  33. }
  34. .atom-dock-mask {
  35. position: relative;
  36. background-color: @tool-panel-background-color;
  37. overflow: hidden; // Mask the content.
  38. // One of these will be overridden by the component with an explicit size.
  39. // Which depends on the position of the dock.
  40. width: 100%;
  41. height: 100%;
  42. transition: none;
  43. &.atom-dock-should-animate {
  44. transition: width 0.2s ease-out, height 0.2s ease-out;
  45. }
  46. }
  47. .atom-dock-content-wrapper {
  48. position: absolute;
  49. display: flex;
  50. flex: 1;
  51. align-items: stretch;
  52. width: 100%;
  53. height: 100%;
  54. // The contents of the dock should be "stuck" to the moving edge of the mask,
  55. // so it looks like they're sliding in (instead of being unmasked in place).
  56. &.right { left: 0; }
  57. &.bottom { top: 0; }
  58. &.left { right: 0; }
  59. // Use flex-direction to put the resize handle in the correct place.
  60. &.left { flex-direction: row-reverse; }
  61. &.bottom { flex-direction: column; }
  62. &.right { flex-direction: row; }
  63. }
  64. // Toggle button --------------
  65. .atom-dock-toggle-button {
  66. position: absolute;
  67. overflow: hidden; // Mask half of the circle.
  68. // Must be > .scrollbar-content and inactive atom-dock
  69. z-index: 11;
  70. // Position the toggle button target at the edge of the dock. It's important
  71. // that this is absolutely positioned so that it doesn't expand the area of
  72. // its container (which would block mouse events).
  73. &.right { right: 100%; }
  74. &.bottom { bottom: 100%; }
  75. &.left { left: 100%; }
  76. width: @atom-dock-toggle-button-size;
  77. height: @atom-dock-toggle-button-size;
  78. &.bottom { height: (@atom-dock-toggle-button-size / 2); }
  79. &.left, &.right { width: (@atom-dock-toggle-button-size / 2); }
  80. .atom-dock-toggle-button-inner {
  81. width: @atom-dock-toggle-button-size;
  82. height: @atom-dock-toggle-button-size;
  83. border-radius: (@atom-dock-toggle-button-size / 2);
  84. position: absolute;
  85. display: flex;
  86. text-align: center;
  87. justify-content: center;
  88. align-items: center;
  89. cursor: pointer;
  90. // Promote to own layer, fixes rendering issue atom/atom#14915
  91. will-change: transform;
  92. &.right {
  93. left: 0;
  94. }
  95. &.bottom {
  96. top: 0;
  97. }
  98. &.left {
  99. right: 0;
  100. }
  101. }
  102. // Hide the button.
  103. &:not(.atom-dock-toggle-button-visible) {
  104. .atom-dock-toggle-button-inner {
  105. &.right { transform: translateX(50%); }
  106. &.bottom { transform: translateY(50%); }
  107. &.left { transform: translateX(-50%); }
  108. }
  109. }
  110. // Center the icon.
  111. @offset: 8px;
  112. .atom-dock-toggle-button-inner {
  113. &.right .icon { transform: translateX(-@offset); }
  114. &.bottom .icon { transform: translateY(-@offset); }
  115. &.left .icon { transform: translateX(@offset); }
  116. }
  117. // Animate the icon.
  118. .icon {
  119. transition: opacity 0.1s ease-in 0.1s; // intro
  120. opacity: 1;
  121. &::before {
  122. // Shrink the icon element to the size of the character.
  123. width: auto;
  124. margin: 0;
  125. }
  126. }
  127. &:not(.atom-dock-toggle-button-visible) .icon {
  128. opacity: 0;
  129. transition: opacity 0.2s ease-out 0s; // outro
  130. }
  131. .atom-dock-toggle-button-inner {
  132. background-color: @tool-panel-background-color;
  133. border: 1px solid @pane-item-border-color;
  134. transition: transform 0.2s ease-out 0s; // intro
  135. }
  136. &:not(.atom-dock-toggle-button-visible) {
  137. // Don't contribute to mouseenter/drag events when not visible.
  138. pointer-events: none;
  139. .atom-dock-toggle-button-inner {
  140. transition: transform 0.2s ease-out 0.1s; // outro
  141. }
  142. }
  143. }
  144. // Resize handle --------------
  145. .atom-dock-resize-handle {
  146. width: auto;
  147. height: auto;
  148. flex: 0 0 auto;
  149. // Use the resize cursor when the handle's resizable
  150. &.atom-dock-resize-handle-resizable {
  151. &.left, &.right { cursor: col-resize; }
  152. &.bottom { cursor: row-resize; }
  153. }
  154. &.left, &.right { width: @atom-dock-resize-handle-size; }
  155. &.bottom { height: @atom-dock-resize-handle-size; }
  156. }
  157. // Cursor overlay --------------
  158. .atom-dock-cursor-overlay {
  159. position: fixed;
  160. top: 0;
  161. bottom: 0;
  162. left: 0;
  163. right: 0;
  164. z-index: 4;
  165. &.left,
  166. &.right {
  167. cursor: col-resize;
  168. }
  169. &.bottom {
  170. cursor: row-resize;
  171. }
  172. &:not(.atom-dock-cursor-overlay-visible) {
  173. display: none;
  174. }
  175. }