diff --git a/README.md b/README.md index 381ef592..562e0d53 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,15 @@ pnpm dev makeng + + + momo2019 +
+ momo2019 +
+ + + z09176141 @@ -275,8 +284,6 @@ pnpm dev z09176141 - - a847244052 @@ -312,21 +319,14 @@ pnpm dev pengzhijian + + JiangShuQ
JiangShuQ
- - - - - - momo2019 -
- momo2019 -
diff --git a/packages/core/plugin/MaskPlugin.ts b/packages/core/plugin/MaskPlugin.ts index c350f81c..1f03100f 100644 --- a/packages/core/plugin/MaskPlugin.ts +++ b/packages/core/plugin/MaskPlugin.ts @@ -12,7 +12,7 @@ type IEditor = Editor; class MaskPlugin implements IPluginTempl { static pluginName = 'MaskPlugin'; - static apis = ['setCoverMask', 'workspaceMaskToggle']; + static apis = ['setCoverMask', 'workspaceMaskToggle', 'getworkspaceMaskStatus']; coverMask: null | fabric.Rect = null; workspace: null | fabric.Rect = null; workspaceEl!: HTMLElement; @@ -42,11 +42,18 @@ class MaskPlugin implements IPluginTempl { workspaceMask && this.canvas.remove(workspaceMask); this.workspace?.clone((cloned: fabric.Rect) => { this.canvas.clipPath = cloned; + this.coverMask = null; this.canvas.requestRenderAll(); }); this.editor.off('loadJson', this.initMask); } } + /** + * @desc 获取蒙版开关 + */ + getworkspaceMaskStatus() { + return this.coverMask !== null; + } /** * @desc 获取蒙版 diff --git a/src/components/workspaceMask.vue b/src/components/workspaceMask.vue index c150d4ca..b0d56012 100644 --- a/src/components/workspaceMask.vue +++ b/src/components/workspaceMask.vue @@ -22,6 +22,10 @@ const openMask = ref(false); const onMaskChange = () => { canvasEditor?.workspaceMaskToggle(); }; + +onMounted(() => { + openMask.value = canvasEditor?.getworkspaceMaskStatus(); +});