-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* | ||
* @Author: 秦少卫 | ||
* @Date: 2023-06-20 12:52:09 | ||
* @LastEditors: 秦少卫 | ||
* @LastEditTime: 2024-05-11 14:19:33 | ||
* @LastEditors: June [email protected] | ||
* @LastEditTime: 2024-05-23 17:56:15 | ||
* @Description: 内部插件 | ||
*/ | ||
import { v4 as uuid } from 'uuid'; | ||
|
@@ -108,6 +108,8 @@ class ServersPlugin { | |
this.canvas.renderAll(); | ||
// 加载后钩子 | ||
this.editor.hooksEntity.hookImportAfter.callAsync(jsonFile, () => { | ||
// 修复导入带水印的json无法清除问题 #359 | ||
this.editor?.updateDrawStatus(!!temp['overlayImage']); | ||
this.canvas.renderAll(); | ||
callback && callback(); | ||
this.editor.emit('loadJson'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @Author: June | ||
* @Description: 水印插件 | ||
* @Date: 2024-04-21 08:30:48 | ||
* @LastEditors: June | ||
* @LastEditTime: 2024-04-21 11:07:07 | ||
* @LastEditors: June [email protected] | ||
* @LastEditTime: 2024-05-23 17:56:45 | ||
*/ | ||
import { cloneDeep } from 'lodash-es'; | ||
import { fabric } from 'fabric'; | ||
|
@@ -41,7 +41,7 @@ class WaterMarkPlugin { | |
public canvas: fabric.Canvas; | ||
public editor: IEditor; | ||
static pluginName = 'WaterMarkPlugin'; | ||
static apis = ['drawWaterMark', 'clearWaterMMatk']; | ||
static apis = ['drawWaterMark', 'clearWaterMMatk', 'updateDrawStatus']; | ||
private hadDraw = false; | ||
private drawOps: IDrawOps = defaultOptions; | ||
constructor(canvas: fabric.Canvas, editor: IEditor) { | ||
|
@@ -171,6 +171,11 @@ class WaterMarkPlugin { | |
}); | ||
} | ||
|
||
// 更新handDrow 导入json时无法知道是否绘制 | ||
updateDrawStatus(status: boolean) { | ||
this.hadDraw = status; | ||
} | ||
|
||
clearWaterMMatk() { | ||
if (!this.hadDraw) return; | ||
this.canvas.overlayImage = undefined; | ||
|