gmy-img-cropper.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <view class="container" v-show="isShow">
  3. <view class="page-body uni-content-info">
  4. <view class='cropper-content'>
  5. <view v-if="isShowImg" class="uni-corpper" :style="'width:'+cropperInitW+'px;height:'+cropperInitH+'px;background:#000'">
  6. <view class="uni-corpper-content" :style="'width:'+cropperW+'px;height:'+cropperH+'px;left:'+cropperL+'px;top:'+cropperT+'px'">
  7. <image :src="imageSrc" :style="'width:'+cropperW+'px;height:'+cropperH+'px'"></image>
  8. <view class="uni-corpper-crop-box" @touchstart.stop="contentStartMove" @touchmove.stop="contentMoveing" @touchend.stop="contentTouchEnd"
  9. :style="'left:'+cutL+'px;top:'+cutT+'px;right:'+cutR+'px;bottom:'+cutB+'px'">
  10. <view class="uni-cropper-view-box">
  11. <view class="uni-cropper-dashed-h"></view>
  12. <view class="uni-cropper-dashed-v"></view>
  13. <view class="uni-cropper-line-t" data-drag="top" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  14. <view class="uni-cropper-line-r" data-drag="right" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  15. <view class="uni-cropper-line-b" data-drag="bottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  16. <view class="uni-cropper-line-l" data-drag="left" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  17. <view class="uni-cropper-point point-t" data-drag="top" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  18. <view class="uni-cropper-point point-tr" data-drag="topTight"></view>
  19. <view class="uni-cropper-point point-r" data-drag="right" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  20. <view class="uni-cropper-point point-rb" data-drag="rightBottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  21. <view class="uni-cropper-point point-b" data-drag="bottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove" @touchend.stop="dragEnd"></view>
  22. <view class="uni-cropper-point point-bl" data-drag="bottomLeft"></view>
  23. <view class="uni-cropper-point point-l" data-drag="left" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  24. <view class="uni-cropper-point point-lt" data-drag="leftTop"></view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class='cropper-config'>
  31. <view class="button-box" >
  32. <button type="warn" @click="getImage" > 重选 </button>
  33. <button type="warn" @click="getImageInfo"> 预览 </button>
  34. <button type="warn" @click="finish"> 完成 </button>
  35. </view>
  36. </view>
  37. <canvas canvas-id="myCanvas" :style="'position:absolute;border: 2px solid red; width:'+imageW+'px;height:'+imageH+'px;top:-9999px;left:-9999px;'"></canvas>
  38. </view>
  39. <page-foot :name="name"></page-foot>
  40. </view>
  41. </template>
  42. <script>
  43. let sysInfo = uni.getSystemInfoSync();
  44. let SCREEN_WIDTH = sysInfo.screenWidth;
  45. let SCREEN_HEIGHT = sysInfo.windowHeight+40;
  46. let PAGE_X, // 手按下的x位置
  47. PAGE_Y, // 手按下y的位置
  48. PR = sysInfo.pixelRatio, // dpi
  49. T_PAGE_X, // 手移动的时候x的位置
  50. T_PAGE_Y, // 手移动的时候Y的位置
  51. CUT_L, // 初始化拖拽元素的left值
  52. CUT_T, // 初始化拖拽元素的top值
  53. CUT_R, // 初始化拖拽元素的
  54. CUT_B, // 初始化拖拽元素的
  55. CUT_W, // 初始化拖拽元素的宽度
  56. CUT_H, // 初始化拖拽元素的高度
  57. IMG_RATIO, // 图片比例
  58. IMG_REAL_W, // 图片实际的宽度
  59. IMG_REAL_H, // 图片实际的高度
  60. DRAFG_MOVE_RATIO = 1, //移动时候的比例,
  61. INIT_DRAG_POSITION = 100, // 初始化屏幕宽度和裁剪区域的宽度之差,用于设置初始化裁剪的宽度
  62. DRAW_IMAGE_W = sysInfo.screenWidth // 设置生成的图片宽度
  63. export default {
  64. /**
  65. * 页面的初始数据
  66. */
  67. data() {
  68. return {
  69. isShow:false,
  70. name:'杨大宝',
  71. imageSrc: 'https://img-cdn-qiniu.dcloud.net.cn/demo_crop.jpg',
  72. isShowImg: false,
  73. // 初始化的宽高
  74. cropperInitW: SCREEN_WIDTH,
  75. cropperInitH: SCREEN_HEIGHT,
  76. // 动态的宽高
  77. cropperW: SCREEN_WIDTH,
  78. cropperH: SCREEN_HEIGHT,
  79. // 动态的left top值
  80. cropperL: 0,
  81. cropperT: 0,
  82. transL: 0,
  83. transT: 0,
  84. // 图片缩放值
  85. scaleP: 0,
  86. imageW: 0,
  87. imageH: 0,
  88. // 裁剪框 宽高
  89. cutL: 0,
  90. cutT: 0,
  91. cutB: SCREEN_WIDTH,
  92. cutR: '100%',
  93. qualityWidth: DRAW_IMAGE_W,
  94. innerAspectRadio: DRAFG_MOVE_RATIO
  95. }
  96. },
  97. methods: {
  98. setData: function (obj) {
  99. let that = this;
  100. Object.keys(obj).forEach(function (key) {
  101. that.$set(that.$data, key, obj[key])
  102. });
  103. },
  104. getImage: function () {
  105. var _this = this
  106. uni.chooseImage({
  107. success: function (res) {
  108. _this.setData({
  109. imageSrc: res.tempFilePaths[0],
  110. })
  111. _this.loadImage();
  112. _this.isShow = true;
  113. },
  114. })
  115. },
  116. loadImage: function () {
  117. var _this = this
  118. uni.showLoading({
  119. title: '图片加载中...',
  120. })
  121. uni.getImageInfo({
  122. src: _this.imageSrc,
  123. success: function success(res) {
  124. let imgH = res.height;
  125. let imgW = res.width;
  126. let IMG_SCR_H_R = SCREEN_HEIGHT / imgH;
  127. let IMG_SCR_W_R = SCREEN_WIDTH / imgW;
  128. IMG_RATIO = imgW / imgH;
  129. if(IMG_RATIO<1 && IMG_SCR_H_R<IMG_SCR_W_R ){ //图片更高一些
  130. IMG_REAL_H = SCREEN_HEIGHT-40;
  131. IMG_REAL_W = SCREEN_HEIGHT * IMG_RATIO>(SCREEN_WIDTH-40)? SCREEN_WIDTH-40 : SCREEN_HEIGHT * IMG_RATIO;
  132. }
  133. else{
  134. IMG_REAL_W = SCREEN_WIDTH-40;
  135. IMG_REAL_H = IMG_REAL_W / IMG_RATIO;
  136. }
  137. let cutT = 0;
  138. let cutB = 0;
  139. let cutL = 0;
  140. let cutR = 0;
  141. _this.setData({
  142. cropperW: IMG_REAL_W,
  143. cropperH: IMG_REAL_H,
  144. // 初始化left right
  145. cropperL: Math.ceil((SCREEN_WIDTH - IMG_REAL_W) / 2),
  146. cropperT: Math.ceil((SCREEN_HEIGHT - IMG_REAL_H) / 2),
  147. cutL: cutL,
  148. cutT: cutT,
  149. cutR: cutR,
  150. cutB: cutB,
  151. // 图片缩放值
  152. imageW: IMG_REAL_W,
  153. imageH: IMG_REAL_H,
  154. scaleP: IMG_REAL_W / SCREEN_WIDTH,
  155. qualityWidth: DRAW_IMAGE_W,
  156. innerAspectRadio: IMG_RATIO
  157. })
  158. _this.setData({
  159. isShowImg: true
  160. })
  161. uni.hideLoading()
  162. }
  163. })
  164. },
  165. // 拖动时候触发的touchStart事件
  166. contentStartMove(e) {
  167. PAGE_X = e.touches[0].pageX
  168. PAGE_Y = e.touches[0].pageY
  169. },
  170. // 拖动时候触发的touchMove事件
  171. contentMoveing(e) {
  172. var _this = this
  173. var dragLengthX = (PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  174. var dragLengthY = (PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  175. // 左移
  176. if (dragLengthX > 0) {
  177. if (this.cutL - dragLengthX < 0) dragLengthX = this.cutL
  178. } else {
  179. if (this.cutR + dragLengthX < 0) dragLengthX = -this.cutR
  180. }
  181. if (dragLengthY > 0) {
  182. if (this.cutT - dragLengthY < 0) dragLengthY = this.cutT
  183. } else {
  184. if (this.cutB + dragLengthY < 0) dragLengthY = -this.cutB
  185. }
  186. this.setData({
  187. cutL: this.cutL - dragLengthX,
  188. cutT: this.cutT - dragLengthY,
  189. cutR: this.cutR + dragLengthX,
  190. cutB: this.cutB + dragLengthY
  191. })
  192. PAGE_X = e.touches[0].pageX
  193. PAGE_Y = e.touches[0].pageY
  194. },
  195. contentTouchEnd() {
  196. },
  197. // 获取图片
  198. getImageInfo() {
  199. var _this = this;
  200. uni.showLoading({
  201. title: '图片生成中...',
  202. });
  203. // 将图片写入画布
  204. const ctx = uni.createCanvasContext('myCanvas',_this);
  205. ctx.drawImage(_this.imageSrc, 0, 0, IMG_REAL_W, IMG_REAL_H);
  206. ctx.draw(true, () => {
  207. // 获取画布要裁剪的位置和宽度 均为百分比 * 画布中图片的宽度 保证了在微信小程序中裁剪的图片模糊 位置不对的问题 canvasT = (_this.cutT / _this.cropperH) * (_this.imageH / pixelRatio)
  208. var canvasW = ((_this.cropperW - _this.cutL - _this.cutR) / _this.cropperW) * IMG_REAL_W;
  209. var canvasH = ((_this.cropperH - _this.cutT - _this.cutB) / _this.cropperH) * IMG_REAL_H;
  210. var canvasL = (_this.cutL / _this.cropperW) * IMG_REAL_W;
  211. var canvasT = (_this.cutT / _this.cropperH) * IMG_REAL_H;
  212. uni.canvasToTempFilePath({
  213. x: canvasL,
  214. y: canvasT,
  215. width: canvasW,
  216. height: canvasH,
  217. destWidth: canvasW,
  218. destHeight: canvasH,
  219. quality: 0.5,
  220. canvasId: 'myCanvas',
  221. success: function (res) {
  222. uni.hideLoading()
  223. // 成功获得地址的地方
  224. uni.previewImage({
  225. current: '', // 当前显示图片的http链接
  226. urls: [res.tempFilePath] // 需要预览的图片http链接列表
  227. })
  228. }
  229. },_this);
  230. });
  231. },
  232. finish:function(){
  233. var _this = this;
  234. uni.showLoading({
  235. title: '图片生成中...',
  236. });
  237. // 将图片写入画布
  238. const ctx = uni.createCanvasContext('myCanvas',_this);
  239. ctx.drawImage(_this.imageSrc, 0, 0, IMG_REAL_W, IMG_REAL_H);
  240. ctx.draw(true, () => {
  241. // 获取画布要裁剪的位置和宽度 均为百分比 * 画布中图片的宽度 保证了在微信小程序中裁剪的图片模糊 位置不对的问题 canvasT = (_this.cutT / _this.cropperH) * (_this.imageH / pixelRatio)
  242. var canvasW = ((_this.cropperW - _this.cutL - _this.cutR) / _this.cropperW) * IMG_REAL_W;
  243. var canvasH = ((_this.cropperH - _this.cutT - _this.cutB) / _this.cropperH) * IMG_REAL_H;
  244. var canvasL = (_this.cutL / _this.cropperW) * IMG_REAL_W;
  245. var canvasT = (_this.cutT / _this.cropperH) * IMG_REAL_H;
  246. uni.canvasToTempFilePath({
  247. x: canvasL,
  248. y: canvasT,
  249. width: canvasW,
  250. height: canvasH,
  251. destWidth: canvasW,
  252. destHeight: canvasH,
  253. quality: 0.5,
  254. canvasId: 'myCanvas',
  255. success: function (res) {
  256. uni.hideLoading()
  257. // 成功获得地址的地方
  258. _this.$emit('getImg',res.tempFilePath);
  259. _this.isShow = false;
  260. }
  261. },_this);
  262. });
  263. },
  264. // 设置大小的时候触发的touchStart事件
  265. dragStart(e) {
  266. T_PAGE_X = e.touches[0].pageX
  267. T_PAGE_Y = e.touches[0].pageY
  268. CUT_L = this.cutL
  269. CUT_R = this.cutR
  270. CUT_B = this.cutB
  271. CUT_T = this.cutT
  272. },
  273. // 设置大小的时候触发的touchMove事件
  274. dragMove(e) {
  275. var _this = this
  276. var dragType = e.target.dataset.drag
  277. switch (dragType) {
  278. case 'right':
  279. var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  280. if (CUT_R + dragLength < 0) dragLength = -CUT_R
  281. this.setData({
  282. cutR: CUT_R + dragLength
  283. })
  284. break;
  285. case 'left':
  286. var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  287. if (CUT_L - dragLength < 0) dragLength = CUT_L
  288. if ((CUT_L - dragLength) > (this.cropperW - this.cutR)) dragLength = CUT_L - (this.cropperW - this.cutR)
  289. this.setData({
  290. cutL: CUT_L - dragLength
  291. })
  292. break;
  293. case 'top':
  294. var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  295. if (CUT_T - dragLength < 0) dragLength = CUT_T
  296. if ((CUT_T - dragLength) > (this.cropperH - this.cutB)) dragLength = CUT_T - (this.cropperH - this.cutB)
  297. this.setData({
  298. cutT: CUT_T - dragLength
  299. })
  300. break;
  301. case 'bottom':
  302. var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  303. if (CUT_B + dragLength < 0) dragLength = -CUT_B
  304. this.setData({
  305. cutB: CUT_B + dragLength
  306. })
  307. break;
  308. case 'rightBottom':
  309. var dragLengthX = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  310. var dragLengthY = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  311. if (CUT_B + dragLengthY < 0) dragLengthY = -CUT_B
  312. if (CUT_R + dragLengthX < 0) dragLengthX = -CUT_R
  313. let cutB = CUT_B + dragLengthY;
  314. let cutR = CUT_R + dragLengthX;
  315. this.setData({
  316. cutB: cutB,
  317. cutR: cutR
  318. })
  319. break;
  320. default:
  321. break;
  322. }
  323. }
  324. }
  325. }
  326. </script>
  327. <style>
  328. /* pages/uni-cropper/index.wxss */
  329. .uni-content-info {
  330. /* position: fixed;
  331. top: 0;
  332. left: 0;
  333. right: 0;
  334. bottom: 0;
  335. display: block;
  336. align-items: center;
  337. flex-direction: column; */
  338. }
  339. .cropper-config {
  340. width: 90%;
  341. position: fixed;
  342. bottom: 10upx;
  343. z-index: 999;
  344. padding: 20upx 40upx;
  345. }
  346. .button-box{
  347. width: 100%;
  348. display: flex;
  349. flex-direction: row;
  350. justify-content:space-between;
  351. }
  352. .button-box button{
  353. height: 80upx;
  354. }
  355. .cropper-content {
  356. min-height: 750upx;
  357. width: 100%;
  358. }
  359. .uni-corpper {
  360. margin: 4px auto;
  361. position: relative;
  362. overflow: hidden;
  363. -webkit-user-select: none;
  364. -moz-user-select: none;
  365. -ms-user-select: none;
  366. user-select: none;
  367. -webkit-tap-highlight-color: transparent;
  368. -webkit-touch-callout: none;
  369. box-sizing: border-box;
  370. }
  371. .uni-corpper-content {
  372. position: relative;
  373. }
  374. .uni-corpper-content image {
  375. display: block;
  376. width: 100%;
  377. min-width: 0 !important;
  378. max-width: none !important;
  379. height: 100%;
  380. min-height: 0 !important;
  381. max-height: none !important;
  382. image-orientation: 0deg !important;
  383. margin: 0 auto;
  384. }
  385. /* 移动图片效果 */
  386. .uni-cropper-drag-box {
  387. position: absolute;
  388. top: 0;
  389. right: 0;
  390. bottom: 0;
  391. left: 0;
  392. cursor: move;
  393. background: rgba(0, 0, 0, 0.6);
  394. z-index: 1;
  395. }
  396. /* 内部的信息 */
  397. .uni-corpper-crop-box {
  398. position: absolute;
  399. background: rgba(255, 255, 255, 0.3);
  400. z-index: 2;
  401. }
  402. .uni-corpper-crop-box .uni-cropper-view-box {
  403. position: relative;
  404. display: block;
  405. width: 100%;
  406. height: 100%;
  407. overflow: visible;
  408. outline: 5upx solid white;
  409. outline-color: rgba(255,255 255, 1)
  410. }
  411. /* 横向虚线 */
  412. .uni-cropper-dashed-h {
  413. position: absolute;
  414. top: 33.33333333%;
  415. left: 0;
  416. width: 100%;
  417. height: 33.33333333%;
  418. border-top: 1upx dashed rgba(255, 255, 255, 0.5);
  419. border-bottom: 1upx dashed rgba(255, 255, 255, 0.5);
  420. }
  421. /* 纵向虚线 */
  422. .uni-cropper-dashed-v {
  423. position: absolute;
  424. left: 33.33333333%;
  425. top: 0;
  426. width: 33.33333333%;
  427. height: 100%;
  428. border-left: 1upx dashed rgba(255, 255, 255, 0.5);
  429. border-right: 1upx dashed rgba(255, 255, 255, 0.5);
  430. }
  431. /* 四个方向的线 为了之后的拖动事件*/
  432. .uni-cropper-line-t {
  433. position: absolute;
  434. display: block;
  435. width: 100%;
  436. background-color: white;
  437. top: 0;
  438. left: 0;
  439. height: 3upx;
  440. opacity: 0.1;
  441. cursor: n-resize;
  442. }
  443. .uni-cropper-line-t::before {
  444. content: '';
  445. position: absolute;
  446. top: 50%;
  447. right: 0upx;
  448. width: 100%;
  449. -webkit-transform: translate3d(0, -50%, 0);
  450. transform: translate3d(0, -50%, 0);
  451. bottom: 0;
  452. height: 41upx;
  453. background: transparent;
  454. z-index: 11;
  455. }
  456. .uni-cropper-line-r {
  457. position: absolute;
  458. display: block;
  459. background-color: white;
  460. top: 0;
  461. right: 0upx;
  462. width: 3upx;
  463. opacity: 0.1;
  464. height: 100%;
  465. cursor: e-resize;
  466. }
  467. .uni-cropper-line-r::before {
  468. content: '';
  469. position: absolute;
  470. top: 0;
  471. left: 50%;
  472. width: 41upx;
  473. -webkit-transform: translate3d(-50%, 0, 0);
  474. transform: translate3d(-50%, 0, 0);
  475. bottom: 0;
  476. height: 100%;
  477. background: transparent;
  478. z-index: 11;
  479. }
  480. .uni-cropper-line-b {
  481. position: absolute;
  482. display: block;
  483. width: 100%;
  484. background-color: white;
  485. bottom: 0;
  486. left: 0;
  487. height: 3upx;
  488. opacity: 0.1;
  489. cursor: s-resize;
  490. }
  491. .uni-cropper-line-b::before {
  492. content: '';
  493. position: absolute;
  494. top: 50%;
  495. right: 0upx;
  496. width: 100%;
  497. -webkit-transform: translate3d(0, -50%, 0);
  498. transform: translate3d(0, -50%, 0);
  499. bottom: 0;
  500. height: 41upx;
  501. background: transparent;
  502. z-index: 11;
  503. }
  504. .uni-cropper-line-l {
  505. position: absolute;
  506. display: block;
  507. background-color: white;
  508. top: 0;
  509. left: 0;
  510. width: 3upx;
  511. opacity: 0.1;
  512. height: 100%;
  513. cursor: w-resize;
  514. }
  515. .uni-cropper-line-l::before {
  516. content: '';
  517. position: absolute;
  518. top: 0;
  519. left: 50%;
  520. width: 41upx;
  521. -webkit-transform: translate3d(-50%, 0, 0);
  522. transform: translate3d(-50%, 0, 0);
  523. bottom: 0;
  524. height: 100%;
  525. background: transparent;
  526. z-index: 11;
  527. }
  528. .uni-cropper-point {
  529. width: 5upx;
  530. height: 5upx;
  531. background-color: white;
  532. opacity: .75;
  533. position: absolute;
  534. z-index: 3;
  535. }
  536. .point-t {
  537. top: -3upx;
  538. left: 50%;
  539. margin-left: -3upx;
  540. cursor: n-resize;
  541. }
  542. .point-tr {
  543. top: -3upx;
  544. left: 100%;
  545. margin-left: -3upx;
  546. cursor: n-resize;
  547. }
  548. .point-r {
  549. top: 50%;
  550. left: 100%;
  551. margin-left: -3upx;
  552. margin-top: -3upx;
  553. cursor: n-resize;
  554. }
  555. .point-rb {
  556. left: 100%;
  557. top: 100%;
  558. -webkit-transform: translate3d(-50%, -50%, 0);
  559. transform: translate3d(-50%, -50%, 0);
  560. cursor: n-resize;
  561. width: 36upx;
  562. height: 36upx;
  563. background-color: white;
  564. position: absolute;
  565. z-index: 1112;
  566. opacity: 1;
  567. }
  568. .point-b {
  569. left: 50%;
  570. top: 100%;
  571. margin-left: -3upx;
  572. margin-top: -3upx;
  573. cursor: n-resize;
  574. }
  575. .point-bl {
  576. left: 0%;
  577. top: 100%;
  578. margin-left: -3upx;
  579. margin-top: -3upx;
  580. cursor: n-resize;
  581. }
  582. .point-l {
  583. left: 0%;
  584. top: 50%;
  585. margin-left: -3upx;
  586. margin-top: -3upx;
  587. cursor: n-resize;
  588. }
  589. .point-lt {
  590. left: 0%;
  591. top: 0%;
  592. margin-left: -3upx;
  593. margin-top: -3upx;
  594. cursor: n-resize;
  595. }
  596. /* 裁剪框预览内容 */
  597. .uni-cropper-viewer {
  598. position: relative;
  599. width: 100%;
  600. height: 100%;
  601. overflow: hidden;
  602. }
  603. .uni-cropper-viewer image {
  604. position: absolute;
  605. z-index: 2;
  606. }
  607. </style>