|
@@ -304,12 +304,17 @@ class ComPDFKitViewer {
|
|
const oldTool = this.activeTool
|
|
const oldTool = this.activeTool
|
|
this.activeTool = tool
|
|
this.activeTool = tool
|
|
this.color = color
|
|
this.color = color
|
|
- this.eventBus.dispatch('toolChanged', { tool, color })
|
|
|
|
|
|
+
|
|
|
|
+ if ((tool === 'editText' || tool === 'addText') && !this.fontFileInited) {
|
|
|
|
+ await this.initFontFile()
|
|
|
|
+ }
|
|
|
|
|
|
const editorTools = ['editText', 'editImage', 'addText', 'addImage']
|
|
const editorTools = ['editText', 'editImage', 'addText', 'addImage']
|
|
if (this.toolMode !== 'editor' && editorTools.includes(oldTool) && !editorTools.includes(this.activeTool)) {
|
|
if (this.toolMode !== 'editor' && editorTools.includes(oldTool) && !editorTools.includes(this.activeTool)) {
|
|
await this.updateTextPtr()
|
|
await this.updateTextPtr()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ this.eventBus.dispatch('toolChanged', { tool, color })
|
|
}
|
|
}
|
|
|
|
|
|
initAnnotations(annotations, render = false) {
|
|
initAnnotations(annotations, render = false) {
|
|
@@ -2665,9 +2670,9 @@ class ComPDFKitViewer {
|
|
async setToolMode(mode) {
|
|
async setToolMode(mode) {
|
|
const oldMode = this.toolMode;
|
|
const oldMode = this.toolMode;
|
|
this.toolMode = mode;
|
|
this.toolMode = mode;
|
|
- // if (mode === 'editor' && !this.fontFileInited) {
|
|
|
|
- // await this.initFontFile()
|
|
|
|
- // }
|
|
|
|
|
|
+ if (mode === 'editor' && !this.fontFileInited) {
|
|
|
|
+ await this.initFontFile()
|
|
|
|
+ }
|
|
this.eventBus.dispatch("toolModeChanged", mode);
|
|
this.eventBus.dispatch("toolModeChanged", mode);
|
|
|
|
|
|
if (oldMode === 'editor' && this.toolMode !== 'editor') {
|
|
if (oldMode === 'editor' && this.toolMode !== 'editor') {
|