_BuildingLevelPicker.scss 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /**
  2. * Adds the styles for the label which displays the currently selected level.
  3. */
  4. @mixin _buildingLevelPickerLabel($container, $theme) {
  5. $base: "#{$container}-label";
  6. $active: "#{$base}--active";
  7. $hover: "#{$base}--hover";
  8. $empty: "#{$base}--empty";
  9. $clear-button: "#{$base}__clear-button";
  10. $clear-button-icon: "#{$base}__clear-button-icon";
  11. $width: 90px;
  12. $height: 40px;
  13. $padding: map-get($theme, padding);
  14. .#{$base} {
  15. color: map-get($theme, label-color);
  16. text-align: center;
  17. font-size: $height;
  18. line-height: $height;
  19. }
  20. .#{$base},
  21. .#{$empty} {
  22. position: relative;
  23. width: $width;
  24. cursor: pointer;
  25. transition: opacity 0.3s;
  26. text-align: center;
  27. &.#{$active} {
  28. color: map-get($theme, label-color--active);
  29. }
  30. }
  31. .#{$empty} {
  32. font-size: $font-size;
  33. font-weight: $font-weight--light;
  34. color: map-get($theme, label-color--empty);
  35. cursor: default;
  36. }
  37. .#{$clear-button} {
  38. $size: 20px;
  39. $icon-size: 12px;
  40. font-size: $icon-size;
  41. line-height: $icon-size;
  42. position: absolute;
  43. top: 10px; // Align with the label.
  44. display: none;
  45. width: $size;
  46. height: $size;
  47. margin-left: $side-spacing--quarter;
  48. padding: ($size - $icon-size) / 2;
  49. cursor: pointer;
  50. transition: all 0.1s ease-in-out;
  51. color: $interactive-font-color;
  52. border: none;
  53. border-radius: 50%;
  54. appearance: none;
  55. &:hover {
  56. background: $background-color--hover;
  57. }
  58. }
  59. // Show the button when we have an active level.
  60. .#{$active} .#{$clear-button} {
  61. display: inline-block;
  62. }
  63. }
  64. /**
  65. * Adds the styles for each of the levels in the level picker level stack.
  66. */
  67. @mixin _buildingLevelPickerLevel($container, $theme) {
  68. $item-container: "#{$container}-item";
  69. $base: "#{$container}-item__base";
  70. $hover: "#{$container}-item--hover";
  71. $active: "#{$container}-item--active";
  72. $animate-level: "#{$container}--animate-level";
  73. .#{$item-container} {
  74. border: 1px solid transparent;
  75. will-change: height;
  76. touch-action: none;
  77. }
  78. .#{$base} {
  79. position: absolute;
  80. left: 50%;
  81. transform: translate(-50%, -50%);
  82. pointer-events: none;
  83. will-change: height;
  84. .rect {
  85. position: absolute;
  86. top: 50%;
  87. left: 50%;
  88. margin-top: 3px;
  89. transform: translate(-50%, -50%) rotateX(66deg) rotateZ(45deg);
  90. pointer-events: none;
  91. border: map-get($theme, level-border-width) solid map-get($theme, level-border-color);
  92. outline: solid 1px transparent; // So things don't move when focusing
  93. background-color: map-get($theme, level-background-color);
  94. will-change: height;
  95. }
  96. }
  97. .#{$hover} .#{$base} {
  98. .rect {
  99. border-color: map-get($theme, level-border-color--hover);
  100. background-color: map-get($theme, level-background-color--hover);
  101. box-shadow: 0 0 2px 1px map-get($theme, level-border-color--hover);
  102. }
  103. }
  104. .#{$active} .#{$base} {
  105. .rect {
  106. border-color: map-get($theme, level-border-color--active);
  107. background-color: map-get($theme, level-background-color--active);
  108. }
  109. }
  110. $in-duration: 0.1s;
  111. $out-duration: 0.3s;
  112. $bg-transition: background-color $in-duration ease-in-out;
  113. $border-transition: border-color $in-duration ease-in-out;
  114. $spring: cubic-bezier(0.63, -0.265, 0.48, 1.64);
  115. $size-transition-out: height $out-duration $spring, width $out-duration $spring;
  116. $size-transition-in: height $in-duration ease-out, width $in-duration ease-out;
  117. .#{$item-container} {
  118. &,
  119. .#{$base},
  120. .rect {
  121. transition: $size-transition-in, $bg-transition, $border-transition;
  122. }
  123. }
  124. // Animate everything when the $animate-level class is present in the parent.
  125. .#{$animate-level} .#{$item-container} {
  126. &,
  127. .#{$base},
  128. .rect {
  129. transition: $size-transition-out, $bg-transition, $border-transition;
  130. }
  131. }
  132. }
  133. /**
  134. * Adds all the styles for the level picker used in the building explorer.
  135. */
  136. @mixin buildingLevelPicker() {
  137. $container: "esri-building-level-picker";
  138. $levels-container: "#{$container}__levels-container";
  139. $levels-inner-container: "#{$container}__inner-levels-container";
  140. $label-container: "#{$container}__label-container";
  141. $no-level: "#{$container}--no-level";
  142. $arrow-up: "#{$container}__arrow-up";
  143. $arrow-down: "#{$container}__arrow-down";
  144. $padding: 12px;
  145. $theme: (
  146. padding: $padding,
  147. label-color: $interactive-font-color,
  148. label-color--empty: $font-color,
  149. label-color--active: $border-color--active,
  150. level-border-width: 2px,
  151. level-border-color: $border-color,
  152. level-border-color--hover: $border-color--active,
  153. level-border-color--active: $border-color--active,
  154. level-background-color: rgba(#fff, 0.7),
  155. level-background-color--hover: rgba(#fff, 0.7),
  156. level-background-color--active: $border-color--active
  157. );
  158. .#{$container} {
  159. display: flex;
  160. flex-direction: row;
  161. align-items: center;
  162. &.#{$no-level} {
  163. display: none;
  164. }
  165. }
  166. .#{$levels-container} {
  167. display: flex;
  168. flex-direction: column;
  169. width: 50%;
  170. padding: 20px 0;
  171. cursor: pointer;
  172. transform: rotate(180deg); // So that our levels stack properly.
  173. justify-content: flex-start;
  174. align-items: center;
  175. }
  176. .#{$levels-inner-container} {
  177. transition: margin 0.3s;
  178. }
  179. .#{$label-container} {
  180. display: flex;
  181. flex-direction: column;
  182. justify-content: space-between;
  183. width: 50%;
  184. height: 90px;
  185. margin-right: $padding;
  186. align-items: center;
  187. }
  188. @include _buildingLevelPickerLabel($container, $theme);
  189. @include _buildingLevelPickerLevel($container, $theme);
  190. .#{$arrow-up},
  191. .#{$arrow-down} {
  192. @include arrowButton();
  193. }
  194. .#{$arrow-up} {
  195. @extend .esri-arrow-up;
  196. }
  197. .#{$arrow-down} {
  198. @extend .esri-arrow-down;
  199. }
  200. }