合并画布,部分样式调整

This commit is contained in:
X1627315083
2025-06-26 15:41:08 +08:00
parent fd05c70937
commit fc6d8d4c8d
75 changed files with 1772 additions and 672 deletions

View File

@@ -2,7 +2,7 @@
<div class="generalCanvas">
<div class="canvasBox" ref="canvasBox">
<editCanvas v-if="canvasLoad" :config="canvasConfig"
:clothingImageUrl="imgUrl"
@canvasInit="canvasInit"
:clothing-image-opts="{
imageMode:'contains',
}"
@@ -55,15 +55,12 @@ export default defineComponent({
const openSetData = ()=>{
data.canvasLoad = true
}
const addImage = (value)=>{
console.log(value)
dataDom.editCanvas.addImageToLayer(value.imgUrl)
const canvasLoadAddImg = (url,id)=>{
dataDom.editCanvas.addImageToLayer(url,{layerId:id,undoable:false})
}
const addBottomImage = (value)=>{
dataDom.editCanvas.changeFixedImage(value)
}
const getData = async ()=>{
const canvasInit = (value)=>{
// return
canvasLoadAddImg(props.imgUrl,value.layers.value[0].id)
}
const getCanvasData = ()=>{
@@ -79,40 +76,15 @@ export default defineComponent({
let img = new Image()
img.onload = ()=>{
let wH = [1,1]
// if(img.width > img.height){
// let domHeight = dataDom.canvasBox.offsetWidth
// let imgWidth = img.width
// data.canvasConfig.height = domHeight
// data.canvasConfig.width = imgHeight/domHeight * img.width
// }else{
// }
let domHeight = dataDom.canvasBox.offsetHeight - 200
let imgHeight = img.height
wH = [1,domHeight/imgHeight]
console.log(domHeight,img.height,img.width)
data.canvasConfig.height = domHeight
data.canvasConfig.width = wH[1] * img.width
// canvasWH.value = height
// // canvasBox.style.width = height+'px'
// let wScale = 1
// let hScale = 1
// if(img.width>img.height){
// hScale = img.height/img.width
// exportWH = img.width
// }else{
// wScale = img.width/img.height
// exportWH = img.height
// }
// ratio = [wScale,hScale]
// canvas = canvasGeneral.canvasInit(canvasBox,{
// width:canvasWH.value * wScale,
// height:canvasWH.value * hScale,
// })
// canvas.selection = false;
// dataDom.editCanvas.addImageToLayer(img)
data.canvasLoad = true
// setTimeout(()=>{
// canvasLoadAddImg()
// },3000)
}
img.src = props.imgUrl
}else{
@@ -127,10 +99,10 @@ export default defineComponent({
...toRefs(data),
...toRefs(dataDom),
isShowMark,
addImage,
getData,
canvasLoadAddImg,
getCanvasData,
canvasSave,
canvasInit,
};
},
data(prop) {