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