修复detail添加印花sort值设置不对
This commit is contained in:
@@ -89,8 +89,8 @@
|
|||||||
<img crossOrigin="anonymous" :src="item?.path" :style="{transform:`rotateZ(${item.pattern?.transform?.rotateZ}deg)`}" class="designOpenrtion_imgItme" draggable="false">
|
<img crossOrigin="anonymous" :src="item?.path" :style="{transform:`rotateZ(${item.pattern?.transform?.rotateZ}deg)`}" class="designOpenrtion_imgItme" draggable="false">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<img :src="selectDetail.path" alt="" class="designOpenrtion_sketch" ref="sketchImg" @load="()=>isSketchLoad = true">
|
<!-- <img :src="selectDetail.path" alt="" class="designOpenrtion_sketch" ref="sketchImg" @load="()=>isSketchLoad = true"> -->
|
||||||
<!-- <img :src="stateOverallSingle == 'single'?(selectDetail.undividedLayer||selectDetail.path):(selectDetail.undividedLayerColor || selectDetail.path)" alt="" class="designOpenrtion_sketch" ref="sketchImg" @load="()=>isSketchLoad = true"> -->
|
<img :src="(selectDetail.path)" alt="" class="designOpenrtion_sketch" ref="sketchImg" @load="()=>isSketchLoad = true">
|
||||||
<img :src="selectDetail.sketchMask" alt="" class="designOpenrtion_sketchMask" ref="sketchMask">
|
<img :src="selectDetail.sketchMask" alt="" class="designOpenrtion_sketchMask" ref="sketchMask">
|
||||||
<div class="designOpenrtion_btn" v-if="stateOverallSingle == 'single'" >
|
<div class="designOpenrtion_btn" v-if="stateOverallSingle == 'single'" >
|
||||||
<ul v-for="item,index in printStyleList[type][stateOverallSingle]" :key="item" :class="{active:item?.pattern.designOpenrtionBtn?item?.pattern.designOpenrtionBtn:false}" class="designOpenrtion_Mousingle" :style="item?.pattern.style" @mousedown.stop="itemMoveMousedown(index,getMousePosition($event,false))" @touchstart.passive="itemMoveMousedown(index,getMousePosition($event,true))">
|
<ul v-for="item,index in printStyleList[type][stateOverallSingle]" :key="item" :class="{active:item?.pattern.designOpenrtionBtn?item?.pattern.designOpenrtionBtn:false}" class="designOpenrtion_Mousingle" :style="item?.pattern.style" @mousedown.stop="itemMoveMousedown(index,getMousePosition($event,false))" @touchstart.passive="itemMoveMousedown(index,getMousePosition($event,true))">
|
||||||
@@ -223,6 +223,7 @@ export default defineComponent({
|
|||||||
img.onload = ()=>{
|
img.onload = ()=>{
|
||||||
let imgScale = img.width / img.height
|
let imgScale = img.width / img.height
|
||||||
let zoom = 2
|
let zoom = 2
|
||||||
|
console.log(editPrintElementData.sketchWH)
|
||||||
let width = editPrintElementData.sketchWH.width / zoom
|
let width = editPrintElementData.sketchWH.width / zoom
|
||||||
let height = width / editPrintElementData.sketchWH.height
|
let height = width / editPrintElementData.sketchWH.height
|
||||||
|
|
||||||
@@ -236,26 +237,41 @@ export default defineComponent({
|
|||||||
x = sketchW / 2
|
x = sketchW / 2
|
||||||
y = sketchH / 2
|
y = sketchH / 2
|
||||||
}
|
}
|
||||||
|
x = sketchW / 2
|
||||||
|
y = sketchH / 2
|
||||||
let location = [x,y]
|
let location = [x,y]
|
||||||
resolve({scale,location})
|
resolve({scale,location})
|
||||||
}
|
}
|
||||||
img.src = item.url
|
img.src = item.url || item.path
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const addPrintELement = async (data:any)=>{
|
const addPrintELement = async (data:any)=>{
|
||||||
if(!editPrintElementData.isSketchLoad)return
|
if(!editPrintElementData.isSketchLoad)return
|
||||||
let {scale,location} = await setScaleLocation(data)
|
let {scale,location} = await setScaleLocation(data)
|
||||||
let allElementPrint = [
|
let printIndex = 0
|
||||||
...(editPrintElementData.selectDetail.printObject.prints || []),
|
let allElementPrint = []
|
||||||
|
if(props.type == 'print'){
|
||||||
|
allElementPrint = [
|
||||||
|
...(editPrintElementData.printStyleList.print.single || []),
|
||||||
|
...(editPrintElementData.printStyleList.print.overall || []),
|
||||||
...(editPrintElementData.selectDetail.trims.prints || []),
|
...(editPrintElementData.selectDetail.trims.prints || []),
|
||||||
]
|
]
|
||||||
let printIndex = Math.max(...allElementPrint.map(item => item.priority)) + 1
|
}else{
|
||||||
|
allElementPrint = [
|
||||||
|
...(editPrintElementData.printStyleList.element.single || []),
|
||||||
|
...(editPrintElementData.selectDetail.printObject.prints || []),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
printIndex = Math.max(...allElementPrint.map(item => Number(item.priority))) + 1
|
||||||
|
console.log(printIndex)
|
||||||
let item = {
|
let item = {
|
||||||
angle:0,
|
angle:0,
|
||||||
designType:data.designType,
|
designType:data.designType,
|
||||||
ifSingle:editPrintElementData.stateOverallSingle == 'single',
|
ifSingle:editPrintElementData.stateOverallSingle == 'single',
|
||||||
level2Type:data.level2Type,
|
level2Type:data.level2Type,
|
||||||
location:editPrintElementData.stateOverallSingle == 'single'?location:[0,0],
|
location:location,
|
||||||
|
// location:editPrintElementData.stateOverallSingle == 'single'?location:[0,0],
|
||||||
minIOPath:data.minIOPath || data.originalUrl,
|
minIOPath:data.minIOPath || data.originalUrl,
|
||||||
path:data.url,
|
path:data.url,
|
||||||
priority:printIndex,
|
priority:printIndex,
|
||||||
@@ -343,6 +359,7 @@ export default defineComponent({
|
|||||||
top = item.location[1] / editPrintElementData.sketchWH.scale[1]
|
top = item.location[1] / editPrintElementData.sketchWH.scale[1]
|
||||||
}else{
|
}else{
|
||||||
//overall
|
//overall
|
||||||
|
console.log(item)
|
||||||
left = item.location[0] / editPrintElementData.sketchWH.scale[0]
|
left = item.location[0] / editPrintElementData.sketchWH.scale[0]
|
||||||
top = item.location[1] / editPrintElementData.sketchWH.scale[1]
|
top = item.location[1] / editPrintElementData.sketchWH.scale[1]
|
||||||
item.scale = [1,1]
|
item.scale = [1,1]
|
||||||
@@ -405,7 +422,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const setPosition = ()=>{
|
const setPosition = async ()=>{
|
||||||
|
await new Promise<void>((resolve, reject) => {
|
||||||
nextTick(()=>{
|
nextTick(()=>{
|
||||||
let img = new Image
|
let img = new Image
|
||||||
img.onload = ()=>{
|
img.onload = ()=>{
|
||||||
@@ -441,15 +459,12 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
setItemPosition()
|
setItemPosition()
|
||||||
}
|
}
|
||||||
// if(props.type == 'print'){
|
resolve('')
|
||||||
// editPrintElementData.overallSingle = state
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// undividedLayer
|
img.src = editPrintElementData.selectDetail.path
|
||||||
//计算宽高使用editPrintElementData.selectDetail.path
|
|
||||||
// img.src = editPrintElementData.selectDetail.path
|
|
||||||
img.src = editPrintElementData.selectDetail.undividedLayer?editPrintElementData.selectDetail.undividedLayer:editPrintElementData.selectDetail.path
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
// watch(()=>editPrintElementData.selectDetail?.id,(newVal)=>{
|
// watch(()=>editPrintElementData.selectDetail?.id,(newVal)=>{
|
||||||
// if(!newVal)return
|
// if(!newVal)return
|
||||||
@@ -860,7 +875,6 @@ export default defineComponent({
|
|||||||
let arr:any = editPrintElementData.printStyleList[props.type][editPrintElementData.stateOverallSingle]
|
let arr:any = editPrintElementData.printStyleList[props.type][editPrintElementData.stateOverallSingle]
|
||||||
|
|
||||||
arr.forEach((item,index) => {item.uniqueId = `${Date.now()}_${index}`});
|
arr.forEach((item,index) => {item.uniqueId = `${Date.now()}_${index}`});
|
||||||
console.log(arr)
|
|
||||||
const sortedArray = [...arr].sort((a, b) => a.priority - b.priority);
|
const sortedArray = [...arr].sort((a, b) => a.priority - b.priority);
|
||||||
const sortMap = {} as any;
|
const sortMap = {} as any;
|
||||||
sortedArray.forEach((item, index) => {
|
sortedArray.forEach((item, index) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user