添加衣服纹理功能
This commit is contained in:
@@ -115,7 +115,8 @@ async function exportSele(canvas,format){
|
||||
}
|
||||
var exportCanvas = new fabric.Canvas(null, {
|
||||
width: activeObjects.width,
|
||||
height: activeObjects.height
|
||||
height: activeObjects.height,
|
||||
backgroundColor: "rgba(255, 255, 255)",
|
||||
});
|
||||
await new Promise((resolve, reject)=>{
|
||||
activeObjects.clone((value)=>{
|
||||
@@ -162,7 +163,7 @@ function JScreateCheck(e){//创建对号
|
||||
});
|
||||
return polyLineBtn
|
||||
}
|
||||
function JScanvasMouseMove(str,e, currentPatterning,downPoint) {
|
||||
function JScanvasMouseMove(str,e, currentPatterning,downPoint,keyDown) {
|
||||
const currentPoint = e.absolutePointer
|
||||
let width,height,top,left,radius,rx,ry
|
||||
switch (str) {
|
||||
@@ -203,7 +204,17 @@ function JScanvasMouseMove(str,e, currentPatterning,downPoint) {
|
||||
break
|
||||
case 'ellipse':
|
||||
rx = Math.abs(downPoint.x - currentPoint.x) / 2
|
||||
ry = Math.abs(downPoint.y - currentPoint.y) / 2
|
||||
if(keyDown.indexOf('ShiftLeft')>-1){
|
||||
ry = Math.abs(downPoint.y - currentPoint.y) / 2
|
||||
if(rx > ry){
|
||||
ry = rx
|
||||
}else{
|
||||
rx = ry
|
||||
}
|
||||
}else{
|
||||
ry = Math.abs(downPoint.y - currentPoint.y) / 2
|
||||
}
|
||||
height = width
|
||||
|
||||
top = currentPoint.y > downPoint.y ? downPoint.y : downPoint.y - ry * 2
|
||||
left = currentPoint.x > downPoint.x ? downPoint.x : downPoint.x - rx * 2
|
||||
@@ -219,7 +230,6 @@ function JScanvasMouseMove(str,e, currentPatterning,downPoint) {
|
||||
points[points.length - 1].y = currentPoint.y
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
function JSRectUpdata(rect, downPointer, upPointer) {
|
||||
let height = (downPointer.y - upPointer.y)
|
||||
@@ -230,4 +240,26 @@ function JSRectUpdata(rect, downPointer, upPointer) {
|
||||
})
|
||||
return rect
|
||||
}
|
||||
export { multiselectJS, JSRectUpdata, JSchangeType, JScanvasMouseDown, JScanvasMouseMove,JScreateCheck,exportSele }
|
||||
async function JSSetTexture(src,){
|
||||
let img
|
||||
await new Promise((resolve, reject) => {
|
||||
img = new Image
|
||||
img.src = src
|
||||
img.onload = ()=>{
|
||||
img.width = 200
|
||||
img.height = 200
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
return img
|
||||
}
|
||||
export {
|
||||
multiselectJS,
|
||||
JSRectUpdata,
|
||||
JSchangeType,
|
||||
JScanvasMouseDown,
|
||||
JScanvasMouseMove,
|
||||
JScreateCheck,
|
||||
exportSele,
|
||||
JSSetTexture
|
||||
}
|
||||
Reference in New Issue
Block a user