2023-11-13-dist
This commit is contained in:
@@ -183,17 +183,18 @@ export default defineComponent({
|
||||
//操作旋转
|
||||
rotote:{
|
||||
mounted(el,value){
|
||||
|
||||
el.addEventListener('mousedown', (e) => {
|
||||
let elParent = document.getElementsByClassName('designOpenrtion_modal')[0].getElementsByClassName('modal_imgItem')[value.instance.imgDomIndex]
|
||||
let mouse = true;
|
||||
let angle = 0
|
||||
let num = 1
|
||||
let x = 0
|
||||
let y = 0
|
||||
num = value.value[1].scale
|
||||
angle = value.value[1].rotateZ
|
||||
let elParent = document.getElementsByClassName('designOpenrtion_modal')[0].getElementsByClassName('modal_imgItem')[value.value[0]]
|
||||
num = value.instance.printStyleList[value.instance.imgDomIndex].transform.scale
|
||||
angle = value.instance.printStyleList[value.instance.imgDomIndex].transform.rotateZ
|
||||
// 添加鼠标按下事件监听器
|
||||
el.style.transform = "rotateZ("+ angle + "deg)"
|
||||
el.addEventListener('mousedown', (e) => {
|
||||
// let scale = Number(elParent.firstElementChild.style.transform?.split('scale(')[1]?.split(')')[0])
|
||||
// let rotateZ = Number(elParent.firstElementChild.style.transform?.split('rotateZ(')[1]?.split('deg')[0])
|
||||
e.stopPropagation()
|
||||
@@ -215,8 +216,7 @@ export default defineComponent({
|
||||
document.addEventListener('mousemove', mousemove);
|
||||
// 添加鼠标松开事件监听器
|
||||
let mouseup = () => {
|
||||
value.instance.printStyleList[value?.value[0]].transform.rotateZ = angle
|
||||
// console.log(value.instance.printStyleList);
|
||||
value.instance.printStyleList[value.instance.imgDomIndex].transform.rotateZ = angle
|
||||
mouse = false;
|
||||
document.removeEventListener('mouseup',mouseup)
|
||||
document.removeEventListener('mousemove',mousemove)
|
||||
@@ -365,18 +365,18 @@ export default defineComponent({
|
||||
let y = ( e.y - this.printStyleList[this.imgDomIndex].centers.top)+'px'
|
||||
this.printStyleList[this.imgDomIndex].style.left = x
|
||||
this.printStyleList[this.imgDomIndex].style.top = y
|
||||
if(x.replace(/px/g,'') >= parentNode.width - imgDomWH.width){
|
||||
this.printStyleList[this.imgDomIndex].style.left = parentNode.width - imgDomWH.width+'px'
|
||||
}
|
||||
if(x.replace(/px/g,'') <= 0){
|
||||
this.printStyleList[this.imgDomIndex].style.left = 0+'px'
|
||||
}
|
||||
if(y.replace(/px/g,'') >= parentNode.height - imgDomWH.height){
|
||||
this.printStyleList[this.imgDomIndex].style.top = parentNode.height - imgDomWH.height+'px'
|
||||
}
|
||||
if(y.replace(/px/g,'') <= 0){
|
||||
this.printStyleList[this.imgDomIndex].style.top = 0+'px'
|
||||
}
|
||||
// if(x.replace(/px/g,'') >= parentNode.width - imgDomWH.width){
|
||||
// this.printStyleList[this.imgDomIndex].style.left = parentNode.width - imgDomWH.width+'px'
|
||||
// }
|
||||
// if(x.replace(/px/g,'') <= 0){
|
||||
// this.printStyleList[this.imgDomIndex].style.left = 0+'px'
|
||||
// }
|
||||
// if(y.replace(/px/g,'') >= parentNode.height - imgDomWH.height){
|
||||
// this.printStyleList[this.imgDomIndex].style.top = parentNode.height - imgDomWH.height+'px'
|
||||
// }
|
||||
// if(y.replace(/px/g,'') <= 0){
|
||||
// this.printStyleList[this.imgDomIndex].style.top = 0+'px'
|
||||
// }
|
||||
},
|
||||
|
||||
sizeMousemove(e) {
|
||||
@@ -452,7 +452,7 @@ export default defineComponent({
|
||||
if(this.printAmount>this.printStyleList.length){
|
||||
let num = this.printAmount - this.printStyleList.length
|
||||
for (let index = 0; index < num; index++) {
|
||||
this.printStyleList.push(this.printStyleList[this.printStyleList.length-1])
|
||||
this.printStyleList.push(JSON.parse(JSON.stringify(this.printStyleList[this.printStyleList.length-1])))
|
||||
this.printStyleList[this.printStyleList.length-1].transform.rotateZ = 0
|
||||
this.refetchTemplate(this.printStyleList.length-1)
|
||||
this.designOpenrtionList.push(this.current.printObject.prints[this.current.printObject.prints.length-1])
|
||||
@@ -487,12 +487,14 @@ export default defineComponent({
|
||||
let rotateZ1 = Math.trunc(Math.random()*360)+1
|
||||
let rotateZ2 = Math.trunc(Math.random()*360)+1
|
||||
let sketch = document.getElementsByClassName("designOpenrtion_modal")[0]?.getElementsByClassName('designOpenrtion_sketch')[0]
|
||||
let width = Math.trunc(Math.random()*(sketch?.width-sketch?.width/3))+1+sketch?.width/3
|
||||
let width
|
||||
let scale
|
||||
if(this.print.width - this.print.height > 0 || this.print.width - this.print.height == 0){
|
||||
if(this.print.width>this.print.height){
|
||||
width = Math.trunc(Math.random()*(sketch?.width-sketch?.width/2))+sketch?.width/3
|
||||
scale = width / this.print.width.replace(/px/g,'')
|
||||
}else{
|
||||
scale = width / this.print.width.replace(/px/g,'')
|
||||
width = Math.trunc(Math.random()*(sketch?.height-sketch?.height/2))+sketch?.height/3
|
||||
scale = width / this.print.height.replace(/px/g,'')
|
||||
}
|
||||
// let x = sketch.width-Number(this.print.width.replace(/px/g,''))
|
||||
// let y = sketch.height-Number(this.print.height.replace(/px/g,''))
|
||||
|
||||
Reference in New Issue
Block a user