Skip to content

Commit bde526f

Browse files
committed
fix(component): 修复蒙版组建和插件状态不同步问题
2 parents 29365c5 + 4806fd7 commit bde526f

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,22 @@ pnpm dev
268268
<sub><b>makeng</b></sub>
269269
</a>
270270
</td>
271+
<td align="center">
272+
<a href="https://github.com/momo2019">
273+
<img src="https://avatars.githubusercontent.com/u/26078793?v=4" width="80;" alt="momo2019"/>
274+
<br />
275+
<sub><b>momo2019</b></sub>
276+
</a>
277+
</td>
278+
</tr>
279+
<tr>
271280
<td align="center">
272281
<a href="https://github.com/z09176141">
273282
<img src="https://avatars.githubusercontent.com/u/49260613?v=4" width="80;" alt="z09176141"/>
274283
<br />
275284
<sub><b>z09176141</b></sub>
276285
</a>
277286
</td>
278-
</tr>
279-
<tr>
280287
<td align="center">
281288
<a href="https://github.com/a847244052">
282289
<img src="https://avatars.githubusercontent.com/u/28621500?v=4" width="80;" alt="a847244052"/>
@@ -312,21 +319,14 @@ pnpm dev
312319
<sub><b>pengzhijian</b></sub>
313320
</a>
314321
</td>
322+
</tr>
323+
<tr>
315324
<td align="center">
316325
<a href="https://github.com/JiangShuQ">
317326
<img src="https://avatars.githubusercontent.com/u/95730895?v=4" width="80;" alt="JiangShuQ"/>
318327
<br />
319328
<sub><b>JiangShuQ</b></sub>
320329
</a>
321-
</td>
322-
</tr>
323-
<tr>
324-
<td align="center">
325-
<a href="https://github.com/momo2019">
326-
<img src="https://avatars.githubusercontent.com/u/26078793?v=4" width="80;" alt="momo2019"/>
327-
<br />
328-
<sub><b>momo2019</b></sub>
329-
</a>
330330
</td>
331331
<td align="center">
332332
<a href="https://github.com/hudenghui">

packages/core/plugin/MaskPlugin.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type IEditor = Editor;
1212

1313
class MaskPlugin implements IPluginTempl {
1414
static pluginName = 'MaskPlugin';
15-
static apis = ['setCoverMask', 'workspaceMaskToggle'];
15+
static apis = ['setCoverMask', 'workspaceMaskToggle', 'getworkspaceMaskStatus'];
1616
coverMask: null | fabric.Rect = null;
1717
workspace: null | fabric.Rect = null;
1818
workspaceEl!: HTMLElement;
@@ -42,11 +42,18 @@ class MaskPlugin implements IPluginTempl {
4242
workspaceMask && this.canvas.remove(workspaceMask);
4343
this.workspace?.clone((cloned: fabric.Rect) => {
4444
this.canvas.clipPath = cloned;
45+
this.coverMask = null;
4546
this.canvas.requestRenderAll();
4647
});
4748
this.editor.off('loadJson', this.initMask);
4849
}
4950
}
51+
/**
52+
* @desc 获取蒙版开关
53+
*/
54+
getworkspaceMaskStatus() {
55+
return this.coverMask !== null;
56+
}
5057

5158
/**
5259
* @desc 获取蒙版

src/components/workspaceMask.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ const openMask = ref(false);
2222
const onMaskChange = () => {
2323
canvasEditor?.workspaceMaskToggle();
2424
};
25+
26+
onMounted(() => {
27+
openMask.value = canvasEditor?.getworkspaceMaskStatus();
28+
});
2529
</script>
2630

2731
<style lang="less" scoped>

0 commit comments

Comments
 (0)