<!--painting-2.wxml-->
 <van-overlay show="{{showPaint}}" z-index="99999999" >
<view class="upage" style="position:reltive;background-color: #000;height:100vh;" catch:tap="hideBarsHandler" wx:if="{{showPaint}}" >


<canvas canvas-id="myCanvas"  disable-scroll="true" bindtouchstart="touchStart"
  bindtouchmove="touchMove" bindtouchend="touchEnd" wx:if="{{hasChoosedImg}}"
  style="position:relative;margin:0 auto;height: {{(canvasHeightLen == 0) ? canvasHeight : canvasHeightLen}}px; width: {{canvasWidth}}px; background: url('{{background}}');background-position: 0 0; background-size: {{canvasWidth}}px {{canvasHeight}}px" 
>
   <image src="{{background}}" mode="" class="imgcover" wx:if="{{hasChoosedImg}}"/>
</canvas>
<view class="failText" wx:if="{{!hasChoosedImg}}" bindtap="addImg" >没有选择照片，点击重新选择</view>

 <!-- 涂鸦工具区 -->
 <view style="padding: 30rpx 32rpx 50rpx;position: fixed;bottom:0;width:100%;box-sizing: border-box;" >
    <view class="space" style="padding-bottom: 20rpx; color: #FFF; font-size: 30rpx; line-height: 56rpx;display: flex;width:100%">
        <view catch:tap="hideTuya">返回</view>
      <view style="width: 30rpx;"></view>
      <view catch:tap="tapBtn" data-type="save">确定</view>
     
      <view style="flex: 1;"></view>
      <view catch:tap="chooseBi" >铅笔</view>
      <view style="width: 30rpx;"></view>
      <view catch:tap="showBarsHandler" data-type="width">笔触</view>
      <view style="width: 30rpx;"></view>
      <view catch:tap="chooseEraser" >橡皮擦</view>
      <view style="width: 30rpx;"></view>
      <view catch:tap="clearCanvas" data-type="clear">清除</view>
    </view>
    <scroll-view scroll-x style="height: 90rpx;">
      <view style="white-space: nowrap;">
        <block wx:for="{{colors}}" wx:key="index">
          <view style="background-color: {{item}};" class="colorBtn {{selectColor == item && 'select'}}" catch:tap="colorChange" data-color="{{item}}" data-type="color"></view>
        </block>
      </view>
    </scroll-view>
  </view>
  <view class="bars {{showBars && 'show'}}" wx:if="{{showBars}}">
  <view class="space vertical_center">
    <view style="width: 136rpx;">字号：</view>
    <slider style="flex: 1;" value="{{selectSize}}" step="1" min="1" max="20" block-size="12" activeColor="#a88cf8" bindchanging="sizeHandler" />
    <view style="width: 50rpx; text-align: right;">{{selectSize}}</view>
  </view>
</view>
</view>
</van-overlay>