Commit e310d760 authored by qipeng's avatar qipeng

拼图

parent e492f882
......@@ -236,7 +236,6 @@ export default {
promiseArray = JSON.parse(JSON.stringify(res[0]))
var promiseArrayNum= promiseArray[promiseArray.length-1].top
console.log('获取到信息头部:', res[0])
console.log(this.screenWidth)
for(let i=0;i<=promiseArray.length-1;i++){
if(i==promiseArray.length-1){//处理背景图
let type = 'image'
......@@ -263,11 +262,15 @@ export default {
let posX = parseInt(promiseArray[i].dataset.tailorx/606*this.screenWidth) //图片所在画板的X轴数据
let posY = parseInt(promiseArray[i].dataset.tailory/606*this.screenWidth) //图片所在画板的Y轴数据
//截图的初始X和Y轴
let tailorx = parseInt(promiseArray[i].dataset.tailorx/606*this.screenWidth)-promiseArray[i].left
//x uni.upx2px(72)+uni.upx2px(promiseArray[i].dataset.tailorx) ---获取左边直至顶部的宽度
let tailorx = (uni.upx2px(72)+uni.upx2px(promiseArray[i].dataset.tailorx))-promiseArray[i].left
if(tailorx<0){//因为用的parseInt 是直接舍去,当出现负数的时候 则算为0
tailorx = 0
}
let tailory = parseInt(promiseArray[i].dataset.tailory/606*this.screenWidth)-(promiseArray[i].top-promiseArrayNum)
//y promiseArrayNum 主边框对顶部的高度 promiseArray[i].dataset.tailory 图片主边框的高度
let tailory = (promiseArrayNum+uni.upx2px(promiseArray[i].dataset.tailory))-promiseArray[i].top+10
console.log(promiseArrayNum+','+uni.upx2px(promiseArray[i].dataset.tailory)+','+promiseArray[i].top)
console.log(tailory)
if(tailory<0){//因为用的parseInt 是直接舍去,当出现负数的时候 则算为0
tailory = 0
}
......@@ -322,7 +325,6 @@ export default {
tx.onload = () => {
// 图片 裁剪 :X Y 宽度 高度
if(i==promiseArray.length-1){//背景
console.log('123456')
textCtx.drawImage(tx, promiseArray[i].posX, promiseArray[i].posY,promiseArray[i].swidth, promiseArray[i].sheight)
}else{//插入的图片
//promiseArray[i].tailorx,promiseArray[i].tailory,promiseArray[i].swidth, promiseArray[i].sheight*1.72,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment