_arrows.less 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // /**
  2. // * Copyright © Magento, Inc. All rights reserved.
  3. // * See COPYING.txt for license details.
  4. // */
  5. .arrow(@pos, @size, @bg-color) {
  6. width: 0;
  7. height: 0;
  8. border: @size solid transparent;
  9. ._abbor_el( @pos, @bg-color );
  10. }
  11. .arrowbox(@pos, @size, @bg-color, @offset:50%) {
  12. @after-margin: @size * -1px;
  13. position: relative;
  14. background: @bg-color;
  15. &:after,
  16. &:before {
  17. ._abpos(@pos);
  18. border: solid transparent;
  19. content: " ";
  20. height: 0;
  21. width: 0;
  22. position: absolute;
  23. pointer-events: none;
  24. }
  25. &:after {
  26. border-color: transparent;
  27. ._abbor_el(@pos, @bg-color);
  28. border-width: @size;
  29. ._abpos_el(@pos, @size, @offset);
  30. ._abmar_el(@pos, @after-margin);
  31. }
  32. }
  33. .arrowbox(@pos, @size, @bg-color, @border-width, @border-color, @offset:50%) {
  34. @before-margin: (@size + round(@border-width * 1.41421356)) * -1px;
  35. .arrowbox(@pos, @size, @bg-color, @offset);
  36. border: @border-width solid @border-color;
  37. &:before {
  38. border-color: transparent;
  39. ._abbor_el(@pos, @border-color);
  40. border-width: @before-margin * -1;
  41. ._abpos_el(@pos, @size, @offset);
  42. ._abmar_el(@pos, @before-margin);
  43. }
  44. }
  45. ._abpos( @pos ) when ( @pos = left ) {
  46. right: 100%;
  47. }
  48. ._abpos( @pos ) when ( @pos = right ) {
  49. left: 100%;
  50. }
  51. ._abpos( @pos ) when ( @pos = up ) {
  52. bottom: 100%;
  53. }
  54. ._abpos( @pos ) when ( @pos = down ) {
  55. top: 100%;
  56. }
  57. ._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = left ) {
  58. top: @size;
  59. }
  60. ._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = right ) {
  61. top: @size;
  62. }
  63. ._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = up ) {
  64. left: @size;
  65. }
  66. ._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = down ) {
  67. left: @size;
  68. }
  69. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = left ) {
  70. top: @offset;
  71. }
  72. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = right ) {
  73. top: @offset;
  74. }
  75. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = up ) {
  76. left: @offset;
  77. }
  78. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = down ) {
  79. left: @offset;
  80. }
  81. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = left ) {
  82. top: @offset + @size;
  83. }
  84. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = right ) {
  85. top: @offset + @size;
  86. }
  87. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = up ) {
  88. left: @offset + @size;
  89. }
  90. ._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = down ) {
  91. left: @offset + @size;
  92. }
  93. ._abbor_el( @pos, @color ) when ( @pos = left ) {
  94. border-right-color: @color;
  95. }
  96. ._abbor_el( @pos, @color ) when ( @pos = right ) {
  97. border-left-color: @color;
  98. }
  99. ._abbor_el( @pos, @color ) when ( @pos = up ) {
  100. border-bottom-color: @color;
  101. }
  102. ._abbor_el( @pos, @color ) when ( @pos = down ) {
  103. border-top-color: @color;
  104. }
  105. ._abmar_el( @pos, @margin ) when ( @pos = left ) {
  106. margin-top: @margin;
  107. }
  108. ._abmar_el( @pos, @margin ) when ( @pos = right ) {
  109. margin-top: @margin;
  110. }
  111. ._abmar_el( @pos, @margin ) when ( @pos = up ) {
  112. margin-left: @margin;
  113. }
  114. ._abmar_el( @pos, @margin ) when ( @pos = down ) {
  115. margin-left: @margin;
  116. }