index.scss 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. @import "./../common/abstracts/_mixin.scss";
  2. @import "./../common/abstracts/variable.scss";
  3. @include b(img-cropper) {
  4. background: rgba(0, 0, 0, 1);
  5. position: fixed;
  6. top: 0;
  7. left: 0;
  8. width: 100vw;
  9. height: 100vh;
  10. z-index: 1;
  11. // 裁剪框包裹器
  12. @include e(wrapper) {
  13. position: relative;
  14. background: rgba(0, 0, 0, 0.45);
  15. }
  16. @include e(cut) {
  17. z-index: 9;
  18. position: absolute;
  19. width: 100vw;
  20. height: 100vh;
  21. display: flex;
  22. flex-direction: column;
  23. pointer-events: none;
  24. .wd-img-cropper__cut--top,
  25. .wd-img-cropper__cut--bottom,
  26. .wd-img-cropper__cut--left,
  27. .wd-img-cropper__cut--right {
  28. // 拖动中背景蒙层为0 拖动结束为0.85
  29. background-color: rgba(0, 0, 0, 0.85);
  30. transition: background 0.2s;
  31. @include when(hightlight) {
  32. background-color: rgba(0, 0, 0, 0);
  33. }
  34. }
  35. .wd-img-cropper__cut--bottom,
  36. .wd-img-cropper__cut--right {
  37. flex: auto;
  38. }
  39. @include m(middle) {
  40. display: flex;
  41. }
  42. @include m(body) {
  43. // 若需要变化窗体大小,支持控制窗体的大小来控制下方所有对应的展示
  44. background-color: transparent;
  45. position: relative;
  46. // 节选框的窗体最外部边缘线
  47. &::before {
  48. content: "";
  49. border: 1px solid #fff;
  50. width: calc(200% - 1px);
  51. height: calc(200% - 1px);
  52. position: absolute;
  53. transform: scale(0.5) translate(-1px, -1px);
  54. top: -50%;
  55. left: -50%;
  56. }
  57. // 结算框对角尺寸
  58. $border-size: 2px;
  59. // 节选框的四个角
  60. .is-left-top,
  61. .is-left-bottom,
  62. .is-right-top,
  63. .is-right-bottom {
  64. &::before {
  65. content: "";
  66. position: absolute;
  67. width: $border-size;
  68. height: 20px;
  69. background-color: #fff;
  70. }
  71. &::after {
  72. content: "";
  73. position: absolute;
  74. width: 20px;
  75. height: $border-size;
  76. background-color: #fff;
  77. }
  78. }
  79. .is-left-top {
  80. &::before,
  81. &::after {
  82. left: -$border-size;
  83. top: -$border-size;
  84. }
  85. }
  86. .is-left-bottom {
  87. &::before,
  88. &::after {
  89. left: -$border-size;
  90. bottom: -$border-size;
  91. }
  92. }
  93. .is-right-top {
  94. &::before,
  95. &::after {
  96. right: -$border-size;
  97. top: -$border-size;
  98. }
  99. }
  100. .is-right-bottom {
  101. &::before,
  102. &::after {
  103. right: -$border-size;
  104. bottom: -$border-size;
  105. }
  106. }
  107. // 内部网格线
  108. .is-gridlines-x,
  109. .is-gridlines-y {
  110. width: 100%;
  111. height: 100%;
  112. position: absolute;
  113. left: 0;
  114. top: 0;
  115. display: flex;
  116. }
  117. .is-gridlines-x {
  118. justify-content: center;
  119. &::before {
  120. content: "";
  121. display: inline-block;
  122. width: 66.66%;
  123. height: 200%;
  124. border: 1px solid #fff;
  125. border-top: none;
  126. border-bottom: none;
  127. transform: scale(0.5) translate(0, -50%);
  128. }
  129. }
  130. // 内部网格线 - y轴
  131. .is-gridlines-y {
  132. align-items: center;
  133. &::after {
  134. content: "";
  135. flex-shrink: 0;
  136. display: inline-block;
  137. width: 200%;
  138. height: 66.66%;
  139. border: 1px solid #fff;
  140. border-left: none;
  141. border-right: none;
  142. transform: scale(0.5) translate(-50%, 0);
  143. }
  144. }
  145. }
  146. }
  147. @include e(img) {
  148. z-index: 2;
  149. top: 0;
  150. left: 0;
  151. position: absolute;
  152. border: none;
  153. width: 100%;
  154. backface-visibility: hidden;
  155. transform-origin: center;
  156. }
  157. @include e(canvas) {
  158. position: fixed;
  159. background: white;
  160. width: 150px;
  161. height: 150px;
  162. z-index: 10;
  163. top: -200%;
  164. pointer-events: none;
  165. }
  166. @include e(footer) {
  167. position: fixed;
  168. z-index: 10;
  169. bottom: 10px;
  170. width: 100%;
  171. height: 15vh;
  172. text-align: center;
  173. @include m(button) {
  174. position: relative;
  175. text-align: left;
  176. margin: 0 20px;
  177. padding-top: 4vh;
  178. // line-height: 32px;
  179. box-sizing: border-box;
  180. .is-cancel {
  181. display: inline-block;
  182. color: #fff;
  183. font-size: 16px;
  184. }
  185. .is-confirm {
  186. position: absolute;
  187. right: 0;
  188. // height: 32px;
  189. width: 56px;
  190. border-radius: 16px;
  191. font-size: 16px;
  192. }
  193. }
  194. }
  195. @include edeep(rotate) {
  196. font-size: $-img-cropper-icon-size;
  197. color: $-img-cropper-icon-color;
  198. }
  199. }