fix: 修复多个已知问题
This commit is contained in:
@@ -19,6 +19,7 @@ import { LiquifyManager } from "./managers/liquify/LiquifyManager";
|
||||
import { SelectionManager } from "./managers/selection/SelectionManager";
|
||||
import { RedGreenModeManager } from "./managers/RedGreenModeManager";
|
||||
import texturePresetManager from "./managers/brushes/TexturePresetManager";
|
||||
import { BrushStore } from "./store/BrushStore";
|
||||
|
||||
// import { MinimapManager } from "./managers/minimap/MinimapManager";
|
||||
|
||||
@@ -185,6 +186,11 @@ function toggleMinimap(enabled) {
|
||||
|
||||
// 初始化画布
|
||||
onMounted(async () => {
|
||||
// 设置BrushStore的全局引用,供BaseBrush使用
|
||||
if (typeof window !== "undefined") {
|
||||
window.BrushStore = BrushStore;
|
||||
}
|
||||
|
||||
// 如果启用了红绿图模式,设置画布大小为默认值
|
||||
if (props.enabledRedGreenMode) {
|
||||
canvasHeight.value = canvasContainerRef.value.clientWidth;
|
||||
@@ -218,7 +224,7 @@ onMounted(async () => {
|
||||
canvas: canvasManager.canvas,
|
||||
canvasWidth: canvasWidth.value,
|
||||
canvasHeight: canvasHeight.value,
|
||||
backgroundColor: canvasColor.value,
|
||||
backgroundColor: canvasColor,
|
||||
isRedGreenMode: props.enabledRedGreenMode,
|
||||
layers,
|
||||
activeLayerId,
|
||||
@@ -744,17 +750,17 @@ defineExpose({
|
||||
//图片url或者base64
|
||||
addImageToLayer: async (
|
||||
url,
|
||||
{ layerId, undoable } = { layerId: null, undoable: true } // 可选参数 layerId 指定图层 将内容添加到指定图层 undoable 是否可撤销 false不可撤销 默认可撤销
|
||||
{ layerId, undoable, ...optios } = { layerId: null, undoable: true } // 可选参数 layerId 指定图层 将内容添加到指定图层 undoable 是否可撤销 false不可撤销 默认可撤销
|
||||
) => {
|
||||
if (!url) return Promise.reject(new Error("图片URL不能为空"));
|
||||
|
||||
if (layerId) {
|
||||
const fabricImage = await loadImage(url);
|
||||
// 如果指定了图层ID,确保图层存在
|
||||
return await canvasManager?.addImageToLayer?.(url, {
|
||||
return await canvasManager?.addImageToLayer?.({
|
||||
targetLayerId: layerId,
|
||||
fabricImage,
|
||||
undoable, // 是否可撤销操作
|
||||
...optios,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -766,7 +772,7 @@ defineExpose({
|
||||
canvas: canvasManager.canvas,
|
||||
toolManager,
|
||||
},
|
||||
{ undoable }
|
||||
{ undoable, ...optios }
|
||||
);
|
||||
},
|
||||
// 导出图片
|
||||
|
||||
Reference in New Issue
Block a user