Explorar el Código

字体旋转修改

sharp-agezi hace 6 años
padre
commit
fa25f45619

+ 7 - 6
customized/pages/made/comb/comb.js

@@ -211,14 +211,15 @@ Page({
       ctx.setFillStyle(fontTouch.isColor);
       // ctx.translate(0, fontTouch.height / 5 * 4);
       // ctx.save();
-      let movex = fontTouch.x + fontTouch.width / 2;
-      let movey = fontTouch.y + fontTouch.height / 10 * 3;
+      let movex =  fontTouch.width / 2;
+      let movey = fontTouch.height / 2;
       ctx.translate(movex, movey);
       ctx.rotate(fontTouch.angle * Math.PI / 180);
-      // ctx.translate(movex, movey);
+      ctx.translate(-movex, -movey);
       // ctx.rotate(fontTouch.angle * Math.PI / 180);
-      ctx.fillText(fontTouch.fontContent, -fontTouch.width / 2, fontTouch.height / 2);
-      // ctx.fillText(fontTouch.fontContent, fontTouch.x, fontTouch.y + fontTouch.height / 5 * 4);
+      // ctx.fillText(fontTouch.fontContent, 0, 0);
+      // ctx.translate(fontTouch.x, fontTouch.y + fontTouch.height / 5 * 4);
+      ctx.fillText(fontTouch.fontContent, fontTouch.x, fontTouch.y +fontTouch.height / 5 * 4);
 
       ctx.draw(false,function () {
         wx.canvasToTempFilePath({
@@ -259,7 +260,7 @@ Page({
           imgSrcArray.forEach((res) => {
             ctx.drawImage(res, dataPositionObj.left * rpx, dataPositionObj.top * rpx, dataPositionObj.width * rpx, dataPositionObj.height * rpx);
           })
-         
+          wx.hideLoading();
           ctx.draw(true, function () {
             wx.canvasToTempFilePath({
               canvasId: 'comb-canvas' + i,

+ 1 - 2
customized/pages/made/comb/comb.json

@@ -1,4 +1,3 @@
 {
-  "usingComponents": {},
-  "disableScroll": true
+  "usingComponents": {}
 }

+ 2 - 2
customized/pages/made/comb/comb.wxml

@@ -1,4 +1,4 @@
-<view style="position:fixed;top:999999999999999999999rpx;">
+<!-- <view style="position:fixed;top:999999999999999999999rpx;"> -->
   <!-- 正面 -->
   <canvas canvas-id="comb-canvas1" class="comb-content"></canvas>
   <canvas canvas-id='comb-img1' class='comb-img'></canvas>
@@ -15,7 +15,7 @@
   <canvas canvas-id="comb-canvas4" class="comb-content"></canvas>
   <canvas canvas-id='comb-img4' class='comb-img4'></canvas>
   <canvas canvas-id='comb-font4' class='comb-font4'></canvas>
-</view>
+<!-- </view> -->
 <view class='comb-view-img'>
   <image wx:for="{{buildSrcArray}}" mode="aspectFit" src='{{item}}'></image>
 </view>