sharp-agezi 6 yıl önce
ebeveyn
işleme
a06730e768

+ 15 - 12
customized/pages/made/combination/combination.js

@@ -48,7 +48,7 @@ Page({
       /*底部 */
     },
     imgSrcArray: [],
-    buildSrc:'',
+    buildSrc: '',
   },
 
   /**
@@ -171,16 +171,19 @@ Page({
     let fontTouch = that.data.fontTouch;
     let dataPositionObj = that.data.dataPositionObj;
     const ctx = wx.createCanvasContext('comb-font');
-
+    ctx.setFontSize(fontTouch.fontSize);
+    ctx.setFillStyle(fontTouch.isColor);
+    // ctx.translate(0, 0);
+    // ctx.save();
     let movex = fontTouch.x + fontTouch.width / 2;
-    let movey = fontTouch.y + fontTouch.height / 2;
+    let movey = fontTouch.y + fontTouch.height /10* 3 ;
+    ctx.translate(movex, movey);
+    ctx.rotate(fontTouch.angle * Math.PI / 180);
     // ctx.translate(movex, movey);
     // ctx.rotate(fontTouch.angle * Math.PI / 180);
-
-    ctx.setFontSize(fontTouch.fontSize);
-    ctx.setFillStyle(fontTouch.isColor);
-    ctx.fillText(fontTouch.fontContent, fontTouch.x, fontTouch.y + fontTouch.height / 5 * 4);
-    // ctx.fillText(fontTouch.fontContent, -fontTouch.width / 2, fontTouch.height / 10 * 3);
+    ctx.fillText(fontTouch.fontContent, -fontTouch.width / 2, fontTouch.height / 2 );
+    // ctx.fillText(fontTouch.fontContent, fontTouch.x, fontTouch.y + fontTouch.height / 5 * 4);
+    
     ctx.draw(true, function () {
       wx.canvasToTempFilePath({
         canvasId: 'comb-font',
@@ -214,11 +217,11 @@ Page({
         imgSrcArray.forEach((res) => {
           ctx.drawImage(res, dataPositionObj.left * rpx, dataPositionObj.top * rpx, dataPositionObj.width * rpx, dataPositionObj.height * rpx);
         })
-        ctx.draw(true,function(){
+        ctx.draw(true, function () {
           wx.canvasToTempFilePath({
             canvasId: 'comb-canvas',
             success: function (res) {
-              console.log(res,"合成成功")
+              console.log(res, "合成成功")
               that.setData({
                 buildSrc: res.tempFilePath
               })
@@ -230,8 +233,8 @@ Page({
               // console.log(that.data.imgSrcArray, "that.data.imgSrcArray")
               // that.getComb(that, that.data.imgSrcArray)
             },
-            fail:function(err){
-              console.log(err,"合成失败")
+            fail: function (err) {
+              console.log(err, "合成失败")
             }
           }, that)
         })

+ 2 - 2
customized/pages/made/combination/combination.json

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

+ 4 - 3
customized/pages/made/combination/combination.wxml

@@ -1,6 +1,7 @@
 <canvas canvas-id="comb-canvas" class="comb-content"></canvas>
-<view style="position:fixed;top:999999999999999999999rpx;">
+<!-- <view style="position:fixed;top:999999999999999999999rpx;"> -->
     <canvas canvas-id='comb-img' class='comb-img'  hidden='{{canvasHidden}}'></canvas>
     <canvas canvas-id='comb-font' class='comb-font'  hidden='{{canvasHidden}}'></canvas>
-</view>
-<image src='{{buildSrc}}'></image>
+<!-- </view> -->
+<image src='{{buildSrc}}'></image>
+ <!-- // "disableScroll": true -->