_ScaleBar.scss 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. @mixin scaleBar() {
  2. $dark_color: $font-color;
  3. $light_color: $background-color;
  4. $block_width: 25%;
  5. $block_height: 50%;
  6. $line_thickness: 2px;
  7. $tic_height: 1.5em;
  8. $offset_for_unit_label: 2ch;
  9. $border_style: $line_thickness solid $dark_color;
  10. .esri-scale-bar.esri-widget {
  11. background: transparent;
  12. box-shadow: none;
  13. }
  14. .esri-scale-bar__bar-container {
  15. position: relative;
  16. display: flex;
  17. align-items: flex-end;
  18. transition: width 250ms ease-in-out;
  19. font-size: $font-size--small;
  20. }
  21. .esri-scale-bar__bar-container--ruler {
  22. flex-direction: column;
  23. }
  24. .esri-scale-bar__bar-container--line:last-child {
  25. align-items: flex-start;
  26. }
  27. .esri-scale-bar__ruler {
  28. display: flex;
  29. flex-wrap: wrap;
  30. height: 6px;
  31. background-color: $light_color;
  32. box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.33), 0 1px 2px rgba(0, 0, 0, 0.3);
  33. }
  34. .esri-scale-bar__ruler-block {
  35. height: $block_height;
  36. width: $block_width;
  37. background-color: $dark_color;
  38. }
  39. // top row
  40. .esri-scale-bar__ruler-block:nth-child(-n + 2) {
  41. margin-right: 25%;
  42. }
  43. // bottom row
  44. .esri-scale-bar__ruler-block:nth-child(n + 3) {
  45. margin-left: 25%;
  46. }
  47. .esri-scale-bar__line {
  48. position: relative;
  49. height: $tic_height;
  50. background-color: rgba($background-color, 0.33);
  51. left: 0;
  52. z-index: 1;
  53. }
  54. .esri-scale-bar__line--top {
  55. bottom: -1px;
  56. border-bottom: $border_style;
  57. }
  58. .esri-scale-bar__line--bottom {
  59. top: floor($line_thickness / 2) * -1;
  60. border-top: $border_style;
  61. }
  62. // tics
  63. .esri-scale-bar__line--top:before,
  64. .esri-scale-bar__line--top:after,
  65. .esri-scale-bar__line--bottom:before,
  66. .esri-scale-bar__line--bottom:after {
  67. content: "";
  68. display: block;
  69. width: $line_thickness;
  70. height: $tic_height;
  71. background-color: $dark_color;
  72. position: absolute;
  73. border-right: $border_style;
  74. }
  75. .esri-scale-bar__line--top:before {
  76. bottom: -$line_thickness;
  77. left: 0;
  78. }
  79. .esri-scale-bar__line--top:after {
  80. bottom: -$line_thickness;
  81. right: 0;
  82. }
  83. .esri-scale-bar__line--bottom:before {
  84. top: -$line_thickness;
  85. left: 0;
  86. }
  87. .esri-scale-bar__line--bottom:after {
  88. height: $tic_height;
  89. top: -$line_thickness;
  90. right: 0;
  91. }
  92. .esri-scale-bar__label-container--line {
  93. position: absolute;
  94. left: 0;
  95. z-index: 1;
  96. }
  97. .esri-scale-bar__label-container--ruler {
  98. display: flex;
  99. width: 100%;
  100. justify-content: space-between;
  101. position: relative;
  102. .esri-scale-bar__label {
  103. padding: $cap-spacing--half 0 0;
  104. text-shadow: 0 0 1px $light_color, 0 0 1px $light_color, 0 0 1px $light_color;
  105. }
  106. }
  107. .esri-scale-bar__label-container--top {
  108. bottom: 0;
  109. }
  110. .esri-scale-bar__label-container--bottom {
  111. top: floor($line_thickness / 2);
  112. }
  113. .esri-scale-bar__label {
  114. font-size: inherit;
  115. color: $dark_color;
  116. white-space: nowrap;
  117. padding: 0 $side-spacing--half;
  118. font-weight: $font-weight--bold;
  119. }
  120. html[dir="rtl"] {
  121. .esri-scale-bar__ruler {
  122. margin: 0 ($offset_for_unit_label / 4) 0 $offset_for_unit_label;
  123. }
  124. .esri-scale-bar__label-container--line {
  125. left: auto;
  126. right: 0;
  127. }
  128. }
  129. }
  130. @if $include_ScaleBar == true {
  131. @include scaleBar();
  132. }