This commit is contained in:
2023-09-26 15:05:14 +08:00
parent d9868d5cf0
commit 98dc5cd8f7
8 changed files with 207 additions and 113 deletions

View File

@@ -74,6 +74,7 @@
</div>
<!-- <img v-if="overallSingle" :src="current?.layersObject?.[1]?.maskUrl" alt="" class="designOpenrtion_sketch"> -->
<img :src="current?.layersObject?.[1]?.imageUrl" alt="" class="designOpenrtion_sketch">
<img v-show="overallSingle" :src="current?.layersObject?.[1]?.maskUrl" alt="" class="designOpenrtion_sketch_mask">
<div class="designOpenrtion_btn">
<ul v-if="overallSingle" v-for="item,index in printStyleList" :key="item" :class="{active:item.designOpenrtionBtn}" class="designOpenrtion_Mousingle" :style="item.style" @mousedown.stop="itemMoveMousedown(index,$event)">
<li class="designOpenrtion_btn_top" @mousedown.stop="itemSizeMousedown('top',$event)"></li>
@@ -254,15 +255,20 @@ export default defineComponent({
this.designOpenrtionList.push(this.current.printObject)
this.overallSingle = DesignPrintOperationParent.overallSingle
this.systemDesignerPercentage = DesignPrintOperationParent.systemDesignerPercentage
let skecth = new Image
if(!this.overallSingle){
skecth.src = this.current.layersObject[1].imageUrl
}else{
skecth.src = this.current.layersObject[1].maskUrl
}
skecth.onload=()=>{
this.sketch.width = skecth.width/10+'rem'
this.sketch.height = skecth.height/10+'rem'
// let skecth = new Image
// if(!this.overallSingle){
// skecth.src = this.current.layersObject[1].imageUrl
// }else{
// skecth.src = this.current.layersObject[1].maskUrl
// }
// skecth.onload=()=>{
// this.sketch.width = skecth.width/10+'rem'
// this.sketch.height = skecth.height/10+'rem'
// }
this.sketch = {
width:this.current.layersObject[1].imageSize[0]/10+'rem',
height:this.current.layersObject[1].imageSize[1]/10+'rem'
}
let print = new Image
print.src = this.current.printObject.path
@@ -272,6 +278,9 @@ export default defineComponent({
this.printStyleList[0].style.width = print.width+'px'
this.printStyleList[0].style.height = print.height+'px'
}
if(this.overallSingle){
this.refetchTemplate(0)
}
},
systemDesigner(num) {
let DesignPrintOperationParent = this.$parent
@@ -484,12 +493,12 @@ export default defineComponent({
//随机重置图片顺序
refetchTemplate(index) {
// let scale = (Math.trunc(Math.random()*15)+1)*.1
let rotateZ1 = Math.trunc(Math.random()*360)+1
let rotateZ2 = Math.trunc(Math.random()*360)+1
let sketch = document.getElementsByClassName('designOpenrtion_sketch')[0]
let width = Math.trunc(Math.random()*(sketch.width-sketch.width/3))+1+sketch.width/3
let scale = width / this.print.width.replace(/px/g,'')
console.log(scale,width,this.print.width);
// let x = sketch.width-Number(this.print.width.replace(/px/g,''))
// let y = sketch.height-Number(this.print.height.replace(/px/g,''))
let x = sketch.width-20
@@ -540,6 +549,7 @@ export default defineComponent({
scale = this.systemDesignerPercentage*3/100
location = [arr[index].style.left.replace(/px/g,'')*sketchNum+this.print.width.replace(/px/g,'')/2-7,arr[index].style.top.replace(/px/g,'')*sketchNum+this.print.height.replace(/px/g,'')/2-7]
}else{
console.log(arr[index].style.width.replace(/px/g,''),this.print.width.replace(/px/g,''));
scale = (arr[index].style.width.replace(/px/g,'')/this.print.width.replace(/px/g,''))
location = [arr[index].style.left.replace(/px/g,'')*sketchNum,arr[index].style.top.replace(/px/g,'')*sketchNum]
}
@@ -821,6 +831,12 @@ export default defineComponent({
position: relative;
max-width: 100%;
max-height: 100%;
width: 100%;
}
.designOpenrtion_sketch_mask{
z-index: 3;
position: absolute;
inset: 0;
}
>div{
position: absolute;
@@ -830,7 +846,7 @@ export default defineComponent({
}
}
.designOpenrtion_print{
z-index: 1;
z-index: 3;
.modal_imgItem{
position: absolute;
overflow: hidden;