welCropper.wxml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template name="welCropper">
  2. <scroll-view class="cropper_main_container {{cropperData.hidden ? 'hidden':''}}">
  3. <view class="cropper_container" style="width:{{cropperData.W}}px; height:{{cropperData.H}}px;">
  4. <canvas class="original_canvas" canvas-id="originalCanvas" style="width:{{cropperChangableData.originalSize.width}}px;height:{{cropperChangableData.originalSize.height}}px;"></canvas>
  5. <image src='{{cropperData.imageInfo.path}}' class='scale-image cropper_canvas_container_item' mode='aspectFill' style="left:{{cropperChangableData.previewImageInfo.x}}px; top:{{cropperChangableData.previewImageInfo.y}}px; width:{{cropperChangableData.previewImageInfo.w}}px; height:{{cropperChangableData.previewImageInfo.h}}px; transform:rotate({{cropperChangableData.rotateDegree}}deg);"></image>
  6. <view class='cropper_canvas_container' style="width:{{cropperChangableData.scaleSize.width}}px;height:{{cropperChangableData.scaleSize.height}}px;">
  7. <canvas class="move_canvas cropper_canvas_container_item" canvas-id="moveCanvas"></canvas>
  8. <block wx:if="{{cropperData.drawSign==1}}">
  9. <movable-area class="cropper_movable_area_container" style="width:{{cropperChangableData.scaleSize.width}}px;height:{{cropperChangableData.scaleSize.height}}px;">
  10. <!-- <movable-view class='main_move_item' style="width:{{cropperMainItem.w}}px; height:{{cropperMainItem.h}}px;" direction="all" x="{{cropperMainItem.x}}" y="{{cropperMainItem.y}}"></movable-view> -->
  11. <block wx:if="{{cropperMovableItems}}">
  12. <block wx:for="{{cropperMovableItems}}" wx:key="moveItem">
  13. <movable-view class="move_item" style="width:{{cropperData.itemLength}}px; height:{{cropperData.itemLength}}px;" direction="all" x="{{item.x-cropperData.itemLength/2}}" y="{{item.y-cropperData.itemLength/2}}" bindtouchmove="moveEvent" bindtouchend="endEvent" data-key="{{index}}"></movable-view>
  14. </block>
  15. </block>
  16. </movable-area>
  17. </block>
  18. <block wx:else>
  19. <movable-area class="cropper_movable_area_container" style="width:{{cropperChangableData.scaleSize.width}}px;height:{{cropperChangableData.scaleSize.height}}px;">
  20. <!-- <movable-view class='main_move_item' style="width:{{cropperMainItem.w}}px; height:{{cropperMainItem.h}}px;" direction="all" x="{{cropperMainItem.x}}" y="{{cropperMainItem.y}}"></movable-view> -->
  21. <block wx:if="{{cropperMovableItems}}">
  22. <block wx:for="{{cropperMovableItems}}" wx:key="moveItem">
  23. <movable-view class="move_item" style="width:{{cropperData.itemLength}}px; height:{{cropperData.itemLength}}px;" direction="all" x="{{item.x-cropperData.itemLength/2}}" y="{{item.y-cropperData.itemLength/2}}" bindtouchmove="moveEvent" bindtouchend="endEvent" data-key="{{index}}"></movable-view>
  24. </block>
  25. </block>
  26. </movable-area>
  27. </block>
  28. </view>
  29. </view>
  30. <view class="cropper_toolbar">
  31. <view class="button_item cancel_button" bindtap="hideCropper">
  32. 取消
  33. </view>
  34. <!-- <view class="button_item crop_shape_button" bindtap="changeCropShapeHandler">
  35. 形状
  36. </view> -->
  37. <view class="button_item rotate_button" bindtap="rotateImage">
  38. 旋转
  39. </view>
  40. <block wx:if="{{cropperData.sizeType.length==2}}">
  41. <view class="original_button button_item {{cropperData.original?'checked':''}}" bindtap="originalChange">
  42. <view>原图</view>
  43. </view>
  44. </block>
  45. <view class="crop_image_button button_item {{cropperChangableData.canCrop?'':'disable'}}" bindtap="{{cropperChangableData.canCrop?'cropImage':''}}">
  46. 完成
  47. </view>
  48. </view>
  49. </scroll-view>
  50. </template>