平铺偏移

This commit is contained in:
李志鹏
2026-01-20 16:11:40 +08:00
parent dbd1651a37
commit 844694d638
4 changed files with 8 additions and 5 deletions

View File

@@ -425,6 +425,7 @@ export class PartManager {
// this.partGroup.add(path);
this.canvas.add(path);
this.canvas.renderAll();
this.clearPart();
}
/** 清空点位 */
clearPart() {

View File

@@ -197,11 +197,11 @@
const cwidth = canvas.width;
const cheight = canvas.height;
let image = await urlToCanvas(item.path);
let offsetX = item.location[0];
let offsetY = item.location[1];
let scaleX = ((cwidth / image.width) * item.scale[0]) / 5;
let scaleY = ((cheight / image.height) * item.scale[1]) / 5;
let scale = cwidth > cheight ? scaleX : scaleY;
let offsetX = item.location[0] * cwidth / props.width - (image.width * scale) / 2;
let offsetY = item.location[1] * cheight / props.height - (image.height * scale) / 2;
let angle = item.angle;
let gapX = item.object.gapX;
let gapY = item.object.gapY;

View File

@@ -898,13 +898,14 @@ export default defineComponent({
}
const inputFillOffset = (offset:any)=>{
let arr = editPrintElementData.printStyleList[props.type].overall
arr[editPrintElementData.imgDomIndex].location = [offset.left * offset.size[0] / 100,offset.top * offset.size[1] / 100]
let location = [offset.left * offset.size[0] / 100,offset.top * offset.size[1] / 100]
arr[editPrintElementData.imgDomIndex].location = location
editPrintElementDom.pingpuRef.updataList([
{
action: ACTIONS.UPDATE,
token: arr[editPrintElementData.imgDomIndex].token,
key: 'location[0]',
value: offset.left,
value: location[0],
},
]);
editPrintElementDom.pingpuRef.updataList([
@@ -912,7 +913,7 @@ export default defineComponent({
action: ACTIONS.UPDATE,
token: arr[editPrintElementData.imgDomIndex].token,
key: 'location[1]',
value: offset.top,
value: location[1],
},
]);
// editPrintElementData.overallDetail.offsetX = offset.left

View File

@@ -92,6 +92,7 @@
let img = new Image();
let size = [0,0];
img.src = props.sketchPath;
console.log(props.sketchPath)
await new Promise((resolve, reject) => {
img.onload = () => {
size = [img.width, img.height]