This commit is contained in:
X1627315083
2025-01-16 09:47:28 +08:00
parent 5c7782113c
commit efc89902cd
5 changed files with 47 additions and 11 deletions

View File

@@ -127,7 +127,6 @@ fabric.Point.prototype.normalize = function(thickness) {
* This makes the drawing editable, it can be moved, rotated, scaled, skewed etc.
*/
fabric.BaseBrush.prototype.convertToPath = function() {
console.log(this.canvas.upperCanvasEl);
var pixelRatio = this.canvas.getRetinaScaling(),
c = fabric.util.copyCanvasElement(this.canvas.upperCanvasEl),
xy = fabric.util.trimCanvas(c),
@@ -147,13 +146,16 @@ fabric.BaseBrush.prototype.convertToPath = function() {
strokeWidth: this._width,
stroke: 'black',
fill:'transparent',
custom:{
dashed:true
},
}).setCoords();
let group = new fabric.Group([pathElemetn],{
left:((xy.x)/pixelRatio-pointerX)/this.canvas.getZoom(),
top:((xy.y)/pixelRatio-pointerY)/this.canvas.getZoom(),
custom:{
dashed:true
}
},
})
this.canvas.add(group).clearContext(this.canvas.contextTop);

View File

@@ -51,7 +51,7 @@
:class="{active:!!email && bindType != 'Modify'}"
placeholder="Enter your email address"
v-model="email"
:disabled="!!email && bindType != 'Modify'"
:disabled="!!userDetail.email && bindType != 'Modify'"
@keydown.enter="submitPerLogin()"
/>
<div v-if="bindType != 'Modify'">

View File

@@ -210,6 +210,8 @@ const userHabit : Module<UserHabit,RootState> = {
state.userDetail.occupation = data.occupation//头像
state.userDetail.usernameModify = data.usernameModify//当月剩余修改次数
state.userDetail.isBeginner = data.isBeginner == 1 ? true : false;//是否完成新手指引
console.log(data);
if(
(!data.email && state.userDetail.email == '-------------') ||
(!data.country && !state.userDetail.country) ||
@@ -345,7 +347,10 @@ const userHabit : Module<UserHabit,RootState> = {
let getUserDetail = ()=>{
return new Promise((resolve,reject) => {
Https.axiosPost(Https.httpUrls.accountDetail).then((rv: any) => {
console.log(rv,'rv1');
if(rv){
console.log(rv,'rv');
context.commit('setUserDetail',rv)
}
resolve('')

View File

@@ -429,8 +429,7 @@ class MyCanvas {
getActiveObject &&
getActiveObject.custom.dashed &&
this.layer.selectLayer.group.custom?.groupType == 'Grid' &&
this.operation == 'movePosition' &&
getActiveObject._objects.length == 1
this.operation == 'movePosition'
){
this.setclipPathImg()
}
@@ -625,7 +624,6 @@ class MyCanvas {
});
MyCanvas.canvas.bringToFront(this.createPatterning.polyLineBtn);//设置优先级最高
}else if(this.operation){
console.log(23232);
this.createPatterning.state = false
MyCanvas.canvas.renderAll();
if(this.operation == 'dashed'){
@@ -642,8 +640,7 @@ class MyCanvas {
async setclipPathImg(){//裁剪图片
if(!this.clipPath.clipGroup)return
this.clipPath.isImg = true
let clipPathElement = this.clipPath.clipGroup._objects.filter(obj => obj.type != 'image')[0]
let clipPathElement = this.clipPath.clipGroup._objects.filter(obj => obj.custom)[0]
let imgBG = MyCanvas.canvas.getObjects().filter(obj => obj.custom.isSelectable && obj.type == 'rect')[0];
let position = {
left:this.clipPath.clipGroup?.left - (imgBG.left?imgBG.left:0),
@@ -1432,7 +1429,8 @@ class MyCanvas {
height: MyCanvas.canvas.height
}))
}
addLayer(options){
async addLayer(options){
console.log(options);
if(this.createPatterning.state)return
this.clipPath.clipGroup = MyCanvas.canvas.getObjects().filter(obj => obj.custom?.dashed)?.[0];
if (options.target.type === 'group' && options.target.custom?.layerId) return;
@@ -1472,8 +1470,35 @@ class MyCanvas {
})
if(!options?.target?.custom?.dashed && this.layer.selectLayer.group.custom.groupType == 'Grid'){
console.log(this.layer.selectLayer.group);
this.layer.selectLayer.group.add(options.target)
await new Promise((resolve, reject) => {
let clipPathElement = this.clipPath.clipGroup._objects.filter(obj => obj.custom)[0]
let clipPathLect = this.clipPath.clipGroup.left
let clipPathTop = this.clipPath.clipGroup.top
clipPathElement.clone((clipPathElementCloned)=>{
clipPathElementCloned.set({
// left:this.clipPath.clipGroup.left,
// top:this.clipPath.clipGroup.top,
left:clipPathLect,
top:clipPathTop,
absolutePositioned:true,
})
let optionLect = (options.target.left - this.clipPath.clipGroup.left) - this.clipPath.clipGroup.width/2
let optionTop = (options.target.top - this.clipPath.clipGroup.top) - this.clipPath.clipGroup.height/2
options.target.clone((cloned)=>{
cloned.set({
left:optionLect,
top:optionTop,
clipPath:clipPathElementCloned,
})
this.clipPath.clipGroup.add(cloned)
console.log(this.clipPath.clipGroup);
MyCanvas.canvas.remove(options.target)
resolve()
})
})
})
// this.setGroupGrid('all')
}

View File

@@ -804,6 +804,10 @@ export default defineComponent({
// type: 'dislike',
// };
// designDetail.showDesignDetailModal(data);
window.addEventListener('resize', ()=> {
this.setSystemDesigner(0)
this.setDesignItemStyle()
})
this.setSystemDesigner(0)
this.setDesignItemStyle()
},