fix
This commit is contained in:
@@ -29,8 +29,12 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
clothingMinIOPath: {
|
||||||
|
type: String,
|
||||||
|
default: "", // 衣服底图URL-线稿
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
console.log(props.clothingMinIOPath)
|
||||||
const commandManager = inject("commandManager");
|
const commandManager = inject("commandManager");
|
||||||
const layerManager = inject("layerManager"); // 图层管理器
|
const layerManager = inject("layerManager"); // 图层管理器
|
||||||
|
|
||||||
@@ -249,7 +253,13 @@ const redGreenToolsList = ref([
|
|||||||
|
|
||||||
// 根据模式选择工具列表
|
// 根据模式选择工具列表
|
||||||
const toolsList = computed(() => {
|
const toolsList = computed(() => {
|
||||||
return props.isRedGreenMode ? redGreenToolsList.value : normalToolsList.value;
|
const list = props.isRedGreenMode ? redGreenToolsList.value : normalToolsList.value;
|
||||||
|
return list.filter(tool => {
|
||||||
|
if(tool.id === OperationType.PART){
|
||||||
|
return !!props.clothingMinIOPath;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function selectTool(tool, isRedGreenMode = false) {
|
function selectTool(tool, isRedGreenMode = false) {
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false, // 是否启用红绿图模式
|
default: false, // 是否启用红绿图模式
|
||||||
},
|
},
|
||||||
|
clothingMinIOPath: {
|
||||||
|
type: String,
|
||||||
|
default: "", // 衣服底图URL-线稿
|
||||||
|
},
|
||||||
clothingImageUrl: {
|
clothingImageUrl: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "", // 衣服底图URL-线稿
|
default: "", // 衣服底图URL-线稿
|
||||||
@@ -378,6 +382,7 @@ onMounted(async () => {
|
|||||||
selectionManager = new SelectionManager({
|
selectionManager = new SelectionManager({
|
||||||
canvas: canvasManager.canvas,
|
canvas: canvasManager.canvas,
|
||||||
layerManager,
|
layerManager,
|
||||||
|
props,
|
||||||
});
|
});
|
||||||
canvasManager.setSelectionManager(selectionManager);
|
canvasManager.setSelectionManager(selectionManager);
|
||||||
|
|
||||||
@@ -387,6 +392,7 @@ onMounted(async () => {
|
|||||||
layerManager,
|
layerManager,
|
||||||
canvasManager,
|
canvasManager,
|
||||||
toolManager,
|
toolManager,
|
||||||
|
props,
|
||||||
});
|
});
|
||||||
canvasManager.setPartManager(partManager);
|
canvasManager.setPartManager(partManager);
|
||||||
|
|
||||||
@@ -1203,6 +1209,7 @@ defineExpose({
|
|||||||
v-if="canvasManagerLoaded"
|
v-if="canvasManagerLoaded"
|
||||||
:activeTool="activeTool"
|
:activeTool="activeTool"
|
||||||
:isRedGreenMode="isRedGreenMode"
|
:isRedGreenMode="isRedGreenMode"
|
||||||
|
:clothingMinIOPath="props.clothingMinIOPath"
|
||||||
@tool-selected="handleToolSelect"
|
@tool-selected="handleToolSelect"
|
||||||
@red-green-tool-selected="handleRedGreenToolSelect"
|
@red-green-tool-selected="handleRedGreenToolSelect"
|
||||||
@toggle-red-green-mode="toggleRedGreenMode"
|
@toggle-red-green-mode="toggleRedGreenMode"
|
||||||
|
|||||||
@@ -1661,6 +1661,7 @@ export class CanvasManager {
|
|||||||
height: image.height,
|
height: image.height,
|
||||||
},
|
},
|
||||||
isPrintTrims: true,
|
isPrintTrims: true,
|
||||||
|
// ...(item.object || {}),
|
||||||
});
|
});
|
||||||
this.canvas.add(rect);
|
this.canvas.add(rect);
|
||||||
let layer = createLayer({
|
let layer = createLayer({
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { CreateSelectionCommand } from "../commands/SelectionCommands";
|
|||||||
import { ClearSelectionCommand } from "../commands/LassoCutoutCommand";
|
import { ClearSelectionCommand } from "../commands/LassoCutoutCommand";
|
||||||
import addIcon from "@/assets/images/canvas/add.png";
|
import addIcon from "@/assets/images/canvas/add.png";
|
||||||
import removeIcon from "@/assets/images/canvas/remove.png";
|
import removeIcon from "@/assets/images/canvas/remove.png";
|
||||||
|
import { Https } from "@/tool/https";
|
||||||
|
import store from "@/store";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部件选择管理器
|
* 部件选择管理器
|
||||||
@@ -25,6 +27,7 @@ export class PartManager {
|
|||||||
this.layerManager = options.layerManager;
|
this.layerManager = options.layerManager;
|
||||||
this.canvasManager = options.canvasManager;
|
this.canvasManager = options.canvasManager;
|
||||||
this.toolManager = options.toolManager;
|
this.toolManager = options.toolManager;
|
||||||
|
this.props = options.props;
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
@@ -214,17 +217,25 @@ export class PartManager {
|
|||||||
this.canvas.upperCanvasEl.style.cursor = icon;
|
this.canvas.upperCanvasEl.style.cursor = icon;
|
||||||
}
|
}
|
||||||
// 点选工具模式下移动事件处理
|
// 点选工具模式下移动事件处理
|
||||||
_pointMoveHandler(options) {
|
_pointMoveHandler(options) { }
|
||||||
|
|
||||||
}
|
|
||||||
// 点选工具模式下抬起事件处理
|
// 点选工具模式下抬起事件处理
|
||||||
_pointUpHandler(options) {
|
_pointUpHandler(options) {
|
||||||
const button = options.button;
|
const button = options.button;
|
||||||
const isLeft = button === 1;// 左键1(添加) 右键3(删除)
|
const isLeft = button === 1;// 左键1(添加) 右键3(删除)
|
||||||
this.canvas.upperCanvasEl.style.cursor = this.defaultCursor;
|
this.canvas.upperCanvasEl.style.cursor = this.defaultCursor;
|
||||||
|
const fixedObject = this.canvasManager.getFixedLayerObject();
|
||||||
|
if (!fixedObject) return console.warn("未找到固定图层");
|
||||||
const { x, y } = options.pointer;
|
const { x, y } = options.pointer;
|
||||||
const fixedObject = this.canvasManager.getFixedLayerObject({ x, y });
|
const width = fixedObject.width * fixedObject.scaleX;
|
||||||
console.log("==========", fixedObject)
|
const height = fixedObject.height * fixedObject.scaleY;
|
||||||
|
const X = x - (fixedObject.left - width / 2);
|
||||||
|
const Y = y - (fixedObject.top - height / 2);
|
||||||
|
this.getSegAnythingImage({
|
||||||
|
image_path: "aida-users/24299/sketch/70bb39cc-63e0-44a9-a627-3542d0f9cd70.png",
|
||||||
|
type: "point",
|
||||||
|
points: [[X, Y], [X - 10, Y - 10]],
|
||||||
|
labels: [1, 0],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -265,6 +276,23 @@ export class PartManager {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 获取分隔后图片
|
||||||
|
async getSegAnythingImage(obj) {
|
||||||
|
const user_id = store.state.UserHabit.userDetail.userId;
|
||||||
|
const data = {
|
||||||
|
user_id,
|
||||||
|
...obj,
|
||||||
|
}
|
||||||
|
Https.axiosPost(Https.httpUrls.segAnything, data)
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除选区
|
* 清除选区
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export class ToolManager {
|
|||||||
this.activeTool = options.activeTool || {
|
this.activeTool = options.activeTool || {
|
||||||
value: OperationType.SELECT,
|
value: OperationType.SELECT,
|
||||||
};
|
};
|
||||||
|
this.props = options.props;
|
||||||
|
|
||||||
// 红绿图模式状态
|
// 红绿图模式状态
|
||||||
this.isRedGreenMode = false;
|
this.isRedGreenMode = false;
|
||||||
|
|||||||
@@ -335,15 +335,15 @@ const otherData = {
|
|||||||
color: {rgba: {r:255,g:0,b:0,a:1}},
|
color: {rgba: {r:255,g:0,b:0,a:1}},
|
||||||
printObject: {
|
printObject: {
|
||||||
prints: [
|
prints: [
|
||||||
{
|
// {
|
||||||
ifSingle: false,
|
// ifSingle: false,
|
||||||
level2Type: "Pattern",
|
// level2Type: "Pattern",
|
||||||
designType: "Library",
|
// designType: "Library",
|
||||||
path: "/src/assets/images/canvas/yinhua1.jpg",
|
// path: "/src/assets/images/canvas/yinhua1.jpg",
|
||||||
location: [250, 780],
|
// location: [250, 780],
|
||||||
scale: [0.3, 0.4],
|
// scale: [0.3, 0.4],
|
||||||
angle: 0,
|
// angle: 0,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
ifSingle: true,
|
ifSingle: true,
|
||||||
level2Type: "Pattern",
|
level2Type: "Pattern",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<editCanvas v-if="canvasLoad" :config="canvasConfig"
|
<editCanvas v-if="canvasLoad" :config="canvasConfig"
|
||||||
@canvasInit="canvasInit"
|
@canvasInit="canvasInit"
|
||||||
is-edit
|
is-edit
|
||||||
|
:clothingMinIOPath="selectDetail.minIOPath"
|
||||||
:clothingImageUrl="selectDetail.path"
|
:clothingImageUrl="selectDetail.path"
|
||||||
:clothingImageUrl2="selectDetail.undividedLayer_"
|
:clothingImageUrl2="selectDetail.undividedLayer_"
|
||||||
showFixedLayer
|
showFixedLayer
|
||||||
|
|||||||
@@ -440,7 +440,10 @@ export const Https = {
|
|||||||
getHistoryNotification: `/api/message/getHistoryNotification`, //获取历史消息
|
getHistoryNotification: `/api/message/getHistoryNotification`, //获取历史消息
|
||||||
oneClickRead: `/api/message/oneClickRead`, //全部设为已读
|
oneClickRead: `/api/message/oneClickRead`, //全部设为已读
|
||||||
personalHomepage: `/api/account/personalHomepage`, //获取个人主页信息
|
personalHomepage: `/api/account/personalHomepage`, //获取个人主页信息
|
||||||
refreshMinioUrl: `/api/third/party/refreshMinioUrl` //获取可以使用的minio地址
|
refreshMinioUrl: `/api/third/party/refreshMinioUrl`, //获取可以使用的minio地址
|
||||||
|
|
||||||
|
// 画布
|
||||||
|
segAnything: `/api/python/segAnything`,//分割Anything
|
||||||
},
|
},
|
||||||
|
|
||||||
axiosGet(url, config) {
|
axiosGet(url, config) {
|
||||||
|
|||||||
Reference in New Issue
Block a user