feat:set the cursor when the page is visible

pr675
黄云飞 3 years ago
parent 75dae9266d
commit 549df61cbf

@ -38,6 +38,14 @@ export class GlobalEvent {
public register() { public register() {
this.cursor = this.draw.getCursor() this.cursor = this.draw.getCursor()
window.addEventListener('blur', (evt) => {
this.recoverEffect(evt)
})
document.addEventListener('visibilitychange', () => {
if (document.visibilityState) {
this.cursor?.drawCursor()
}
})
document.addEventListener('keyup', () => { document.addEventListener('keyup', () => {
this.setRangeStyle() this.setRangeStyle()
}) })
@ -52,7 +60,7 @@ export class GlobalEvent {
}, { passive: false }) }, { passive: false })
} }
public recoverEffect(evt: MouseEvent) { public recoverEffect(evt: Event) {
if (!this.cursor) return if (!this.cursor) return
const cursorDom = this.cursor.getCursorDom() const cursorDom = this.cursor.getCursorDom()
const agentDom = this.cursor.getAgentDom() const agentDom = this.cursor.getAgentDom()
@ -73,7 +81,6 @@ export class GlobalEvent {
} }
this.cursor.recoveryCursor() this.cursor.recoveryCursor()
this.range.recoveryRangeStyle() this.range.recoveryRangeStyle()
this.range.setRange(-1, -1)
this.previewer.clearResizer() this.previewer.clearResizer()
this.tableTool.dispose() this.tableTool.dispose()
this.hyperlinkParticle.clearHyperlinkPopup() this.hyperlinkParticle.clearHyperlinkPopup()

Loading…
Cancel
Save