This commit is contained in:
X1627315083
2025-02-10 14:46:13 +08:00
parent 153a305c9d
commit 74804d16c9

View File

@@ -449,7 +449,7 @@ export default defineComponent({
location:[0,0],
ifSingle:false,
}
this.systemDesignerPercentage = (item.scale[0] && !item.ifSingle)?item.scale[0]*100:30
this.systemDesignerPercentage = (item.scale?.[0] && !item.ifSingle)?item.scale[0]*100:30
}else{
this.printStyleList[this.stateOverallSingle].push(JSON.parse(JSON.stringify(this.currentPrintStyleList)))
let currentIndex = this.printStyleList[this.stateOverallSingle].length-1
@@ -705,41 +705,44 @@ export default defineComponent({
let sketch = document.getElementsByClassName("designOpenrtion_modal")[0]?.getElementsByClassName('designOpenrtion_sketch')[0]
let sketchImg = new Image()
sketchImg.onload = ()=>{
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
let scale
scale = (this.print.width.replace(/px/g,'')*sketchNum/this.print.width.replace(/px/g,''))
let zIndex = 1
let left = item.location[0]/sketchNum+'px'
let top = item.location[1]/sketchNum+'px'
if(sketch.offsetWidth < item.location[0]/sketchNum){
left = sketch.offsetWidth +'px'
}
if(sketch.offsetHeight < item.location[1]/sketchNum){
top = sketch.offsetHeight +'px'
}
if(str == 'overall')this.systemDesignerPercentage = item.scale?item.scale*100:30
this.printStyleList[str][index]={
centers:{
left:0,
top:0,
},
style:{
left:left,
top:top,
right:"auto",
bottom:"auto",
// width:this.print.width.replace(/px/g,'')/sketchNum*item.scale[0]+'px',
// height:this.print.height.replace(/px/g,'')/sketchNum*item.scale[1]+'px',
width:sketch.offsetWidth*item.scale[0]+'px',
height:sketch.offsetHeight*item.scale[1]+'px',
zIndex:zIndex++
},
transform:{
// scale:scale<.2?.2:scale,//0.2-3
rotateZ:item.angle,
},
designOpenrtionBtn:false
}
nextTick(()=>{
let sketchNum = this.sketch.width.replace(/rem/g,'')*10/sketch.offsetWidth
let scale
scale = (this.print.width.replace(/px/g,'')*sketchNum/this.print.width.replace(/px/g,''))
let zIndex = 1
let left = item.location[0]/sketchNum+'px'
let top = item.location[1]/sketchNum+'px'
if(sketch.offsetWidth < item.location[0]/sketchNum){
left = sketch.offsetWidth +'px'
}
if(sketch.offsetHeight < item.location[1]/sketchNum){
top = sketch.offsetHeight +'px'
}
if(str == 'overall')this.systemDesignerPercentage = item.scale?.[0]?item.scale[0]*100:30
this.printStyleList[str][index]={
centers:{
left:0,
top:0,
},
style:{
left:left,
top:top,
right:"auto",
bottom:"auto",
// width:this.print.width.replace(/px/g,'')/sketchNum*item.scale[0]+'px',
// height:this.print.height.replace(/px/g,'')/sketchNum*item.scale[1]+'px',
width:sketch.offsetWidth*item.scale[0]+'px',
height:sketch.offsetHeight*item.scale[1]+'px',
zIndex:zIndex++
},
transform:{
// scale:scale<.2?.2:scale,//0.2-3
rotateZ:item.angle,
},
designOpenrtionBtn:false
}
})
sketchImg.remove()
}
sketchImg.src = sketch.src