yeyouzi-cropper.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. // components/yeyouzi-cropper/yeyouzi-cropper.js
  2. let success;
  3. let fail;
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. canvas: '',
  15. ctx: '',
  16. dpr: '',
  17. x1: 0,
  18. y1: 0,
  19. x2: 0,
  20. y2: 0,
  21. k1: 0,
  22. m1: 0,
  23. k2: 0,
  24. m2: 0,
  25. cutMove: false,
  26. endCut: {
  27. x: 0,
  28. y: 0
  29. },
  30. movePoint: '0',
  31. img: {
  32. path: '',
  33. width: 0,
  34. height: 0,
  35. type: 1 // 1:横向 2:纵向
  36. },
  37. imageWidth: 0,
  38. imageHeight: 0,
  39. imageLeft: 0,
  40. imageTop: 0,
  41. imgRotate: 0,
  42. imgMirror: 0,
  43. originWidthShow: 0.5,
  44. originHeightShow: 0.5,
  45. imgMove: false,
  46. imgStart: {
  47. x: 0,
  48. y: 0,
  49. left: 0,
  50. top: 0,
  51. distance: 0,
  52. width: 0,
  53. height: 0,
  54. cutImg: ''
  55. },
  56. imgScale: false,
  57. cutImg: {
  58. path: '',
  59. x: 0,
  60. y: 0,
  61. width: 0,
  62. height: 0
  63. }
  64. },
  65. /**
  66. * 组件的方法列表
  67. */
  68. methods: {
  69. /**
  70. * 公有方法
  71. */
  72. //初始化
  73. init(param) {
  74. success = param.success
  75. fail = param.fail
  76. var that = this;
  77. this.setData({
  78. img: {
  79. path: param.imgPath
  80. }
  81. })
  82. const query = wx.createSelectorQuery().in(this)
  83. query.select('#cutCanvas')
  84. .fields({
  85. node: true,
  86. size: true
  87. })
  88. .exec((res) => {
  89. const canvas = res[0].node
  90. const ctx = canvas.getContext('2d')
  91. const dpr = 0.84
  92. canvas.width = res[0].width * dpr
  93. canvas.height = res[0].height * dpr
  94. ctx.scale(dpr, dpr)
  95. var x1 = canvas.width * 0.15 / dpr;
  96. var y1 = (canvas.height - canvas.width * 0.7) / 2 / dpr;
  97. var x2 = x1 + canvas.width * 0.7 / dpr;
  98. var y2 = y1 + canvas.width * 0.7 / dpr;
  99. var k1 = (y2 - y1) / (x2 - x1);
  100. var m1 = (x2 * y1 - x1 * y2) / (x2 - x1)
  101. var k2 = (y1 - y2) / (x2 - x1);
  102. var m2 = (x2 * y2 - x1 * y1) / (x2 - x1);
  103. that.setData({
  104. canvas: canvas,
  105. ctx: ctx,
  106. dpr: dpr,
  107. x1: x1,
  108. y1: y1,
  109. x2: x2,
  110. y2: y2,
  111. k1: k1,
  112. m1: m1,
  113. k2: k2,
  114. m2: m2
  115. })
  116. this._drawCut(x1, y1, x2, y2)
  117. wx.getImageInfo({
  118. src: param.imgPath,
  119. success(img) {
  120. var width = '';
  121. var height = '';
  122. var type = 0;
  123. var x = '';
  124. var y = '';
  125. var d = '';
  126. if (img.width > img.height) {
  127. height = that.data.y2 - that.data.y1;
  128. width = (img.width * height) / img.height
  129. type = 1
  130. d = img.height
  131. x = (img.width - d) / 2
  132. y = 0
  133. } else {
  134. width = that.data.x2 - that.data.x1;
  135. height = (img.height * width) / img.width
  136. type = 2
  137. d = img.width
  138. x = 0
  139. y = (img.height - d) / 2
  140. }
  141. that.setData({
  142. img: {
  143. path: param.imgPath,
  144. width: img.width,
  145. height: img.height,
  146. type: type
  147. },
  148. cutImg: {
  149. x: x,
  150. y: y,
  151. width: d,
  152. height: d
  153. },
  154. imageWidth: ((x2 - x1) / d) * img.width,
  155. imageHeight: ((y2 - y1) / d) * img.height,
  156. imageLeft: x1 - ((x2 - x1) / d) * x,
  157. imageTop: y1 - ((y2 - y1) / d) * y,
  158. imgRotate: 0
  159. })
  160. }
  161. })
  162. })
  163. },
  164. /**
  165. * 私有方法
  166. */
  167. _drawCut(x1, y1, x2, y2) {
  168. var ctx = this.data.ctx;
  169. var canvas = this.data.canvas;
  170. ctx.clearRect(0, 0, canvas.width, canvas.height)
  171. ctx.globalAlpha = '0.5'
  172. ctx.fillStyle = '#000000'
  173. ctx.fillRect(0, 0, canvas.width, canvas.height)
  174. ctx.strokeStyle = '#ffffff'
  175. ctx.lineWidth = '3'
  176. ctx.lineCap = 'square'
  177. ctx.globalAlpha = '1'
  178. ctx.strokeRect(x1, y1, x2 - x1, y2 - y1)
  179. ctx.fillStyle = '#ffffff'
  180. ctx.fillRect(x1 - 5, y1 - 5, 20, 20) //左上角 1
  181. ctx.fillRect(x2 - 15, y1 - 5, 20, 20) //右上角 2
  182. ctx.fillRect(x1 - 5, y2 - 15, 20, 20) //左下角 3
  183. ctx.fillRect(x2 - 15, y2 - 15, 20, 20) //右下角 4
  184. ctx.clearRect(x1, y1, x2 - x1, y2 - y1)
  185. },
  186. _touchStart(e) {
  187. //裁剪框是否移动
  188. var flag = false;
  189. var point = '0'
  190. if (e.touches[0].x >= this.data.x1 - 10 && this.data.x1 + 10 >= e.touches[0].x) {
  191. if (e.touches[0].y >= this.data.y1 - 10 && this.data.y1 + 10 >= e.touches[0].y) {
  192. flag = true;
  193. point = '1';
  194. this.setData({
  195. endCut: {
  196. x: this.data.x1,
  197. y: this.data.y1
  198. }
  199. })
  200. } else if (e.touches[0].y >= this.data.y2 - 10 && this.data.y2 + 10 >= e.touches[0].y) {
  201. flag = true;
  202. point = '3';
  203. this.setData({
  204. endCut: {
  205. x: this.data.x1,
  206. y: this.data.y2
  207. }
  208. })
  209. }
  210. } else if (e.touches[0].x >= this.data.x2 - 10 && this.data.x2 + 10 >= e.touches[0].x) {
  211. if (e.touches[0].y >= this.data.y1 - 10 && this.data.y1 + 10 >= e.touches[0].y) {
  212. flag = true;
  213. point = '2'
  214. this.setData({
  215. endCut: {
  216. x: this.data.x2,
  217. y: this.data.y1
  218. }
  219. })
  220. } else if (e.touches[0].y >= this.data.y2 - 10 && this.data.y2 + 10 >= e.touches[0].y) {
  221. flag = true;
  222. point = '4'
  223. this.setData({
  224. endCut: {
  225. x: this.data.x2,
  226. y: this.data.y2
  227. }
  228. })
  229. }
  230. }
  231. this.setData({
  232. cutMove: flag,
  233. movePoint: point
  234. })
  235. //图片是否移动
  236. if (e.touches[0].x >= this.data.x1 + 10 && this.data.x2 - 10 >= e.touches[0].x) {
  237. if (e.touches[0].y >= this.data.y1 + 10 && this.data.y2 - 10 >= e.touches[0].y) {
  238. if (e.touches.length == 1) {
  239. this.setData({
  240. imgMove: true,
  241. imgStart: {
  242. x: e.touches[0].x,
  243. y: e.touches[0].y,
  244. left: this.data.imageLeft,
  245. top: this.data.imageTop
  246. },
  247. imgScale: false
  248. })
  249. } else if (e.touches.length == 2) {
  250. this.setData({
  251. imgMove: false,
  252. imgStart: {
  253. distance: Math.sqrt(Math.pow(e.touches[1].x - e.touches[0].x, 2) + Math.pow(e.touches[1].y - e.touches[0].y, 2)),
  254. width: this.data.imageWidth,
  255. height: this.data.imageHeight,
  256. cutImg: this.data.cutImg
  257. },
  258. imgScale: true
  259. })
  260. }
  261. }
  262. }
  263. },
  264. _touchMove(e) {
  265. if (this.data.cutMove) {
  266. var x1;
  267. var y1;
  268. var x2;
  269. var y2;
  270. if (this.data.movePoint == '1') {
  271. x1 = e.touches[0].x
  272. y1 = this.data.k1 * x1 + this.data.m1
  273. x2 = this.data.x2
  274. y2 = this.data.y2
  275. if (x1 > x2 - 100) {
  276. x1 = x2 - 100
  277. y1 = this.data.k1 * x1 + this.data.m1
  278. } else if (x1 < this.data.x1) {
  279. x1 = this.data.x1
  280. y1 = this.data.k1 * x1 + this.data.m1
  281. }
  282. this.setData({
  283. endCut: {
  284. x: x1,
  285. y: y1
  286. }
  287. })
  288. } else if (this.data.movePoint == '2') {
  289. x2 = e.touches[0].x
  290. y1 = this.data.k2 * x2 + this.data.m2
  291. x1 = this.data.x1
  292. y2 = this.data.y2
  293. if (x2 > this.data.x2) {
  294. x2 = this.data.x2
  295. y1 = this.data.y1
  296. } else if (x2 < this.data.x1 + 100) {
  297. x2 = this.data.x1 + 100
  298. y1 = this.data.k2 * x2 + this.data.m2
  299. }
  300. this.setData({
  301. endCut: {
  302. x: x2,
  303. y: y1
  304. }
  305. })
  306. } else if (this.data.movePoint == '3') {
  307. x1 = e.touches[0].x
  308. y2 = this.data.k2 * x1 + this.data.m2
  309. x2 = this.data.x2
  310. y1 = this.data.y1
  311. if (x1 > x2 - 100) {
  312. x1 = x2 - 100
  313. y2 = this.data.k2 * x1 + this.data.m2
  314. } else if (x1 < this.data.x1) {
  315. x1 = this.data.x1
  316. y2 = this.data.y2
  317. }
  318. this.setData({
  319. endCut: {
  320. x: x1,
  321. y: y2
  322. }
  323. })
  324. } else if (this.data.movePoint == '4') {
  325. x2 = e.touches[0].x
  326. y2 = this.data.k1 * x2 + this.data.m1
  327. x1 = this.data.x1
  328. y1 = this.data.y1
  329. if (x2 > this.data.x2) {
  330. x2 = this.data.x2
  331. y2 = this.data.k1 * x2 + this.data.m1
  332. } else if (x2 < x1 + 100) {
  333. x2 = x1 + 100
  334. y2 = this.data.k1 * x2 + this.data.m1
  335. }
  336. this.setData({
  337. endCut: {
  338. x: x2,
  339. y: y2
  340. }
  341. })
  342. }
  343. this._drawCut(x1, y1, x2, y2)
  344. } else if (this.data.imgMove) {
  345. var dx = this.data.imgStart.x - e.touches[0].x
  346. var dy = this.data.imgStart.y - e.touches[0].y
  347. var rotate = this.data.imgRotate
  348. var left = this.data.imgStart.left - dx
  349. var top = this.data.imgStart.top - dy
  350. if (this.data.imgMirror == 180) {
  351. dx = -dx
  352. rotate = -rotate
  353. }
  354. var tx = dx * Math.cos(rotate * Math.PI / 180) + dy * Math.sin(rotate * Math.PI / 180)
  355. var ty = dy * Math.cos(rotate * Math.PI / 180) - dx * Math.sin(rotate * Math.PI / 180)
  356. var x = (tx + this.data.originWidthShow * this.data.imageWidth) / this.data.imageWidth * this.data.img.width - this.data.cutImg.width / 2
  357. var y = (ty + this.data.originHeightShow * this.data.imageHeight) / this.data.imageHeight * this.data.img.height - this.data.cutImg.height / 2
  358. this.setData({
  359. cutImg: {
  360. width: this.data.cutImg.width,
  361. height: this.data.cutImg.height,
  362. x: x,
  363. y: y
  364. },
  365. imageLeft: left,
  366. imageTop: top,
  367. })
  368. } else if (this.data.imgScale) {
  369. var nowDistance = Math.sqrt(Math.pow(e.touches[1].x - e.touches[0].x, 2) + Math.pow(e.touches[1].y - e.touches[0].y, 2))
  370. var m = nowDistance / this.data.imgStart.distance
  371. var width = this.data.imgStart.width * m
  372. var height = this.data.imgStart.height * m
  373. if (this.data.img.type == 1) {
  374. height = height < this.data.y2 - this.data.y1 ? this.data.y2 - this.data.y1 : height
  375. height = height > (this.data.y2 - this.data.y1) * 10 ? (this.data.y2 - this.data.y1) * 10 : height
  376. width = (height * this.data.img.width) / this.data.img.height
  377. } else {
  378. width = width < this.data.x2 - this.data.x1 ? this.data.x2 - this.data.x1 : width
  379. width = width > (this.data.x2 - this.data.x1) * 10 ? (this.data.x2 - this.data.x1) * 10 : width
  380. height = (width * this.data.img.height) / this.data.img.width
  381. }
  382. var n = width / this.data.imgStart.width
  383. var cut = {
  384. x: this.data.imgStart.cutImg.x + ((n - 1) / (2 * n)) * this.data.imgStart.cutImg.width,
  385. y: this.data.imgStart.cutImg.y + ((n - 1) / (2 * n)) * this.data.imgStart.cutImg.height,
  386. width: this.data.imgStart.cutImg.width / n,
  387. height: this.data.imgStart.cutImg.height / n
  388. }
  389. var left = this.data.x1 - ((this.data.x2 - this.data.x1) / cut.width) * cut.x
  390. left = left > this.data.x1 ? this.data.x1 : left
  391. left = left < this.data.x2 - this.data.imageWidth ? this.data.x2 - this.data.imageWidth : left
  392. var top = this.data.y1 - ((this.data.y2 - this.data.y1) / cut.height) * cut.y
  393. top = top > this.data.y1 ? this.data.y1 : top
  394. top = top < this.data.y2 - this.data.imageHeight ? this.data.y2 - this.data.imageHeight : top
  395. this.setData({
  396. imageLeft: left,
  397. imageTop: top,
  398. imageWidth: width,
  399. imageHeight: height,
  400. cutImg: {
  401. x: cut.x,
  402. y: cut.y,
  403. width: cut.width,
  404. height: cut.height
  405. },
  406. })
  407. }
  408. },
  409. _touchEnd(e) {
  410. if (this.data.cutMove) {
  411. var dx;
  412. var dy;
  413. var d;
  414. var movePoint = this.data.movePoint
  415. if (movePoint % 2 == 0) {
  416. d = ((this.data.endCut.x - this.data.x1) * this.data.cutImg.width) / (this.data.x2 - this.data.x1)
  417. if (this.data.imgMirror == 180) {
  418. dx = -(this.data.endCut.x - this.data.x2) / this.data.imageWidth * this.data.img.width / 2
  419. if (movePoint == '2') {
  420. dy = (this.data.endCut.y - this.data.y1) / this.data.imageHeight * this.data.img.height / 2
  421. } else {
  422. dy = (this.data.endCut.y - this.data.y2) / this.data.imageHeight * this.data.img.height / 2
  423. }
  424. } else {
  425. dx = (this.data.endCut.x - this.data.x2) / this.data.imageWidth * this.data.img.width / 2
  426. if (movePoint == '2') {
  427. dy = (this.data.endCut.y - this.data.y1) / this.data.imageHeight * this.data.img.height / 2
  428. } else {
  429. dy = (this.data.endCut.y - this.data.y2) / this.data.imageHeight * this.data.img.height / 2
  430. }
  431. }
  432. } else {
  433. d = ((this.data.x2 - this.data.endCut.x) * this.data.cutImg.width) / (this.data.x2 - this.data.x1)
  434. if (this.data.imgMirror == 180) {
  435. dx = -(this.data.endCut.x - this.data.x1) / this.data.imageWidth * this.data.img.width / 2
  436. if (movePoint == '1') {
  437. dy = (this.data.endCut.y - this.data.y1) / this.data.imageHeight * this.data.img.height / 2
  438. } else {
  439. dy = (this.data.endCut.y - this.data.y2) / this.data.imageHeight * this.data.img.height / 2
  440. }
  441. } else {
  442. dx = (this.data.endCut.x - this.data.x1) / this.data.imageWidth * this.data.img.width / 2
  443. if (movePoint == '1') {
  444. dy = (this.data.endCut.y - this.data.y1) / this.data.imageHeight * this.data.img.height / 2
  445. } else {
  446. dy = (this.data.endCut.y - this.data.y2) / this.data.imageHeight * this.data.img.height / 2
  447. }
  448. }
  449. }
  450. var rotate = this.data.imgMirror == 180 ? -this.data.imgRotate : this.data.imgRotate
  451. var x = ((dx * Math.cos(rotate * Math.PI / 180) + dy * Math.sin(rotate * Math.PI / 180)) + this.data.originWidthShow * this.data.img.width) - d / 2
  452. var y = ((dy * Math.cos(rotate * Math.PI / 180) - dx * Math.sin(rotate * Math.PI / 180)) + this.data.originHeightShow * this.data.img.height) - d / 2
  453. this.setData({
  454. cutImg: {
  455. x: x,
  456. y: y,
  457. width: d,
  458. height: d
  459. },
  460. imageWidth: ((this.data.x2 - this.data.x1) / d) * this.data.img.width,
  461. imageHeight: ((this.data.y2 - this.data.y1) / d) * this.data.img.height,
  462. imageLeft: this.data.x1 - ((this.data.x2 - this.data.x1) / d) * x,
  463. imageTop: this.data.y1 - ((this.data.y2 - this.data.y1) / d) * y,
  464. })
  465. this._drawCut(this.data.x1, this.data.y1, this.data.x2, this.data.y2)
  466. }
  467. if (this.data.imgMove) {
  468. var left = this.data.x1 - ((this.data.x2 - this.data.x1) / this.data.cutImg.width) * this.data.cutImg.x
  469. var top = this.data.y1 - ((this.data.y2 - this.data.y1) / this.data.cutImg.height) * this.data.cutImg.y
  470. this.setData({
  471. imageLeft: left,
  472. imageTop: top,
  473. })
  474. }
  475. this.setData({
  476. originWidthShow: (this.data.cutImg.x + this.data.cutImg.width / 2) / this.data.img.width,
  477. originHeightShow: (this.data.cutImg.y + this.data.cutImg.height / 2) / this.data.img.height,
  478. cutMove: false,
  479. movePoint: '0',
  480. imgMove: false,
  481. imgScale: false
  482. })
  483. },
  484. _rotateChange(e) {
  485. this.setData({
  486. imgRotate: e.detail.value
  487. })
  488. },
  489. /* _rotateNinety() {
  490. var r = this.data.imgRotate + 90 > 180 ? this.data.imgRotate - 270 : this.data.imgRotate + 90
  491. this.setData({
  492. imgRotate: r
  493. })
  494. }, */
  495. /* _imageMirror() {
  496. var m = this.data.imgMirror == 180 ? 0 : 180
  497. this.setData({
  498. imgMirror: m,
  499. })
  500. }, */
  501. /* _imgRestore(){
  502. this.setData({
  503. canvas: '',
  504. ctx: '',
  505. x1: 0,
  506. y1: 0,
  507. x2: 0,
  508. y2: 0,
  509. k1: 0,
  510. m1: 0,
  511. k2: 0,
  512. m2: 0,
  513. cutMove: false,
  514. endCut: {
  515. x: 0,
  516. y: 0
  517. },
  518. movePoint: '0',
  519. imageWidth: 0,
  520. imageHeight: 0,
  521. imageLeft: 0,
  522. imageTop: 0,
  523. imgRotate: 0,
  524. imgMirror: 0,
  525. originWidthShow: 0.5,
  526. originHeightShow: 0.5,
  527. imgMove: false,
  528. imgStart: {
  529. x: 0,
  530. y: 0,
  531. left: 0,
  532. top: 0,
  533. distance: 0,
  534. width: 0,
  535. height: 0,
  536. cutx: 0,
  537. cuty: 0
  538. },
  539. imgScale: false,
  540. cutImg: {
  541. path: '',
  542. x: 0,
  543. y: 0,
  544. width: 0,
  545. height: 0
  546. }
  547. })
  548. this.init(this.data.img.path)
  549. }, */
  550. _cancelCut() {
  551. this._restoreData()
  552. if (fail) {
  553. fail('cancel')
  554. }
  555. },
  556. _confirmCut() {
  557. wx.showLoading({
  558. title: '裁剪中...',
  559. mask: true
  560. })
  561. var that = this
  562. const query = wx.createSelectorQuery().in(this)
  563. query.select('#imgCanvas')
  564. .fields({
  565. node: true,
  566. size: true
  567. })
  568. .exec((res) => {
  569. const canvas = res[0].node
  570. const ctx = canvas.getContext('2d')
  571. canvas.width = that.data.cutImg.width
  572. canvas.height = that.data.cutImg.height
  573. ctx.translate(canvas.width / 2, canvas.height / 2)
  574. ctx.rotate((that.data.imgRotate >= 0 ? that.data.imgRotate : that.data.imgRotate + 360) * Math.PI / 180)
  575. if (that.data.imgMirror == 180) {
  576. ctx.scale(-1, 1); //左右镜像翻转
  577. }
  578. const img = canvas.createImage()
  579. img.src = that.data.img.path
  580. img.onload = () => {
  581. ctx.drawImage(img, 0, 0, that.data.img.width, that.data.img.height, -(that.data.cutImg.x + canvas.width / 2), -(that.data.cutImg.y + canvas.height / 2), that.data.img.width, that.data.img.height)
  582. wx.canvasToTempFilePath({
  583. canvas: canvas,
  584. success(img) {
  585. success(img.tempFilePath)
  586. that._restoreData()
  587. wx.hideLoading({
  588. success: (res) => {},
  589. })
  590. },
  591. fail(res) {
  592. console.log(res, '裁剪失败');
  593. wx.hideLoading({
  594. success: (res) => {
  595. wx.showToast({
  596. title: '裁剪失败',
  597. icon: 'error'
  598. })
  599. if (fail) {
  600. fail('fail')
  601. }
  602. },
  603. })
  604. }
  605. })
  606. }
  607. })
  608. },
  609. _restoreData() {
  610. this.setData({
  611. canvas: '',
  612. ctx: '',
  613. x1: 0,
  614. y1: 0,
  615. x2: 0,
  616. y2: 0,
  617. k1: 0,
  618. m1: 0,
  619. k2: 0,
  620. m2: 0,
  621. cutMove: false,
  622. endCut: {
  623. x: 0,
  624. y: 0
  625. },
  626. movePoint: '0',
  627. img: {
  628. path: '',
  629. width: 0,
  630. height: 0,
  631. type: 1 // 1:横向 2:纵向
  632. },
  633. imageWidth: 0,
  634. imageHeight: 0,
  635. imageLeft: 0,
  636. imageTop: 0,
  637. imgRotate: 0,
  638. imgMirror: 0,
  639. originWidthShow: 0.5,
  640. originHeightShow: 0.5,
  641. imgMove: false,
  642. imgStart: {
  643. x: 0,
  644. y: 0,
  645. left: 0,
  646. top: 0,
  647. distance: 0,
  648. width: 0,
  649. height: 0,
  650. cutx: 0,
  651. cuty: 0
  652. },
  653. imgScale: false,
  654. cutImg: {
  655. path: '',
  656. x: 0,
  657. y: 0,
  658. width: 0,
  659. height: 0
  660. }
  661. })
  662. },
  663. }
  664. })