cropper.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. $cropper-image-path: '../images' !default;
  2. .cropper {
  3. &-container {
  4. direction: ltr;
  5. font-size: 0;
  6. line-height: 0;
  7. position: relative;
  8. touch-action: none;
  9. user-select: none;
  10. img {
  11. display: block;
  12. height: 100%;
  13. image-orientation: 0deg;
  14. max-height: none !important;
  15. max-width: none !important;
  16. min-height: 0 !important;
  17. min-width: 0 !important;
  18. width: 100%;
  19. }
  20. }
  21. &-wrap-box,
  22. &-canvas,
  23. &-drag-box,
  24. &-crop-box,
  25. &-modal {
  26. bottom: 0;
  27. left: 0;
  28. position: absolute;
  29. right: 0;
  30. top: 0;
  31. }
  32. &-wrap-box,
  33. &-canvas {
  34. overflow: hidden;
  35. }
  36. &-drag-box {
  37. background-color: #fff;
  38. opacity: 0;
  39. }
  40. &-modal {
  41. background-color: #000;
  42. opacity: 0.5;
  43. }
  44. &-view-box {
  45. display: block;
  46. height: 100%;
  47. outline: 1px solid #39f;
  48. outline-color: rgba(51, 153, 255, 0.75);
  49. overflow: hidden;
  50. width: 100%;
  51. }
  52. &-dashed {
  53. border: 0 dashed #eee;
  54. display: block;
  55. opacity: 0.5;
  56. position: absolute;
  57. &.dashed-h {
  58. border-bottom-width: 1px;
  59. border-top-width: 1px;
  60. height: calc(100% / 3);
  61. left: 0;
  62. top: calc(100% / 3);
  63. width: 100%;
  64. }
  65. &.dashed-v {
  66. border-left-width: 1px;
  67. border-right-width: 1px;
  68. height: 100%;
  69. left: calc(100% / 3);
  70. top: 0;
  71. width: calc(100% / 3);
  72. }
  73. }
  74. &-center {
  75. display: block;
  76. height: 0;
  77. left: 50%;
  78. opacity: 0.75;
  79. position: absolute;
  80. top: 50%;
  81. width: 0;
  82. &::before,
  83. &::after {
  84. background-color: #eee;
  85. content: ' ';
  86. display: block;
  87. position: absolute;
  88. }
  89. &::before {
  90. height: 1px;
  91. left: -3px;
  92. top: 0;
  93. width: 7px;
  94. }
  95. &::after {
  96. height: 7px;
  97. left: 0;
  98. top: -3px;
  99. width: 1px;
  100. }
  101. }
  102. &-face,
  103. &-line,
  104. &-point {
  105. display: block;
  106. height: 100%;
  107. opacity: 0.1;
  108. position: absolute;
  109. width: 100%;
  110. }
  111. &-face {
  112. background-color: #fff;
  113. left: 0;
  114. top: 0;
  115. }
  116. &-line {
  117. background-color: #39f;
  118. &.line-e {
  119. cursor: ew-resize;
  120. right: -3px;
  121. top: 0;
  122. width: 5px;
  123. }
  124. &.line-n {
  125. cursor: ns-resize;
  126. height: 5px;
  127. left: 0;
  128. top: -3px;
  129. }
  130. &.line-w {
  131. cursor: ew-resize;
  132. left: -3px;
  133. top: 0;
  134. width: 5px;
  135. }
  136. &.line-s {
  137. bottom: -3px;
  138. cursor: ns-resize;
  139. height: 5px;
  140. left: 0;
  141. }
  142. }
  143. &-point {
  144. background-color: #39f;
  145. height: 5px;
  146. opacity: 0.75;
  147. width: 5px;
  148. &.point-e {
  149. cursor: ew-resize;
  150. margin-top: -3px;
  151. right: -3px;
  152. top: 50%;
  153. }
  154. &.point-n {
  155. cursor: ns-resize;
  156. left: 50%;
  157. margin-left: -3px;
  158. top: -3px;
  159. }
  160. &.point-w {
  161. cursor: ew-resize;
  162. left: -3px;
  163. margin-top: -3px;
  164. top: 50%;
  165. }
  166. &.point-s {
  167. bottom: -3px;
  168. cursor: s-resize;
  169. left: 50%;
  170. margin-left: -3px;
  171. }
  172. &.point-ne {
  173. cursor: nesw-resize;
  174. right: -3px;
  175. top: -3px;
  176. }
  177. &.point-nw {
  178. cursor: nwse-resize;
  179. left: -3px;
  180. top: -3px;
  181. }
  182. &.point-sw {
  183. bottom: -3px;
  184. cursor: nesw-resize;
  185. left: -3px;
  186. }
  187. &.point-se {
  188. bottom: -3px;
  189. cursor: nwse-resize;
  190. height: 20px;
  191. opacity: 1;
  192. right: -3px;
  193. width: 20px;
  194. @media (min-width: 768px) {
  195. height: 15px;
  196. width: 15px;
  197. }
  198. @media (min-width: 992px) {
  199. height: 10px;
  200. width: 10px;
  201. }
  202. @media (min-width: 1200px) {
  203. height: 5px;
  204. opacity: 0.75;
  205. width: 5px;
  206. }
  207. }
  208. &.point-se::before {
  209. background-color: #39f;
  210. bottom: -50%;
  211. content: ' ';
  212. display: block;
  213. height: 200%;
  214. opacity: 0;
  215. position: absolute;
  216. right: -50%;
  217. width: 200%;
  218. }
  219. }
  220. &-invisible {
  221. opacity: 0;
  222. }
  223. &-bg {
  224. background-image: url('#{$cropper-image-path}/bg.png');
  225. }
  226. &-hide {
  227. display: block;
  228. height: 0;
  229. position: absolute;
  230. width: 0;
  231. }
  232. &-hidden {
  233. display: none !important;
  234. }
  235. &-move {
  236. cursor: move;
  237. }
  238. &-crop {
  239. cursor: crosshair;
  240. }
  241. &-disabled &-drag-box,
  242. &-disabled &-face,
  243. &-disabled &-line,
  244. &-disabled &-point {
  245. cursor: not-allowed;
  246. }
  247. }