|
|
|
@ -7,12 +7,14 @@ import { KeyMap } from "../../dataset/enum/Keymap"
|
|
|
|
import { IElement } from "../../interface/Element"
|
|
|
|
import { IElement } from "../../interface/Element"
|
|
|
|
import { ICurrentPosition } from "../../interface/Position"
|
|
|
|
import { ICurrentPosition } from "../../interface/Position"
|
|
|
|
import { writeTextByElementList } from "../../utils/clipboard"
|
|
|
|
import { writeTextByElementList } from "../../utils/clipboard"
|
|
|
|
|
|
|
|
import { zipElementList } from "../../utils/element"
|
|
|
|
import { Cursor } from "../cursor/Cursor"
|
|
|
|
import { Cursor } from "../cursor/Cursor"
|
|
|
|
import { Draw } from "../draw/Draw"
|
|
|
|
import { Draw } from "../draw/Draw"
|
|
|
|
import { HyperlinkParticle } from "../draw/particle/HyperlinkParticle"
|
|
|
|
import { HyperlinkParticle } from "../draw/particle/HyperlinkParticle"
|
|
|
|
import { ImageParticle } from "../draw/particle/ImageParticle"
|
|
|
|
import { ImageParticle } from "../draw/particle/ImageParticle"
|
|
|
|
import { TableTool } from "../draw/particle/table/TableTool"
|
|
|
|
import { TableTool } from "../draw/particle/table/TableTool"
|
|
|
|
import { HistoryManager } from "../history/HistoryManager"
|
|
|
|
import { HistoryManager } from "../history/HistoryManager"
|
|
|
|
|
|
|
|
import { Listener } from "../listener/Listener"
|
|
|
|
import { Position } from "../position/Position"
|
|
|
|
import { Position } from "../position/Position"
|
|
|
|
import { RangeManager } from "../range/RangeManager"
|
|
|
|
import { RangeManager } from "../range/RangeManager"
|
|
|
|
|
|
|
|
|
|
|
|
@ -32,6 +34,7 @@ export class CanvasEvent {
|
|
|
|
private imageParticle: ImageParticle
|
|
|
|
private imageParticle: ImageParticle
|
|
|
|
private tableTool: TableTool
|
|
|
|
private tableTool: TableTool
|
|
|
|
private hyperlinkParticle: HyperlinkParticle
|
|
|
|
private hyperlinkParticle: HyperlinkParticle
|
|
|
|
|
|
|
|
private listener: Listener
|
|
|
|
|
|
|
|
|
|
|
|
constructor(draw: Draw) {
|
|
|
|
constructor(draw: Draw) {
|
|
|
|
this.isAllowDrag = false
|
|
|
|
this.isAllowDrag = false
|
|
|
|
@ -48,6 +51,7 @@ export class CanvasEvent {
|
|
|
|
this.imageParticle = this.draw.getImageParticle()
|
|
|
|
this.imageParticle = this.draw.getImageParticle()
|
|
|
|
this.tableTool = this.draw.getTableTool()
|
|
|
|
this.tableTool = this.draw.getTableTool()
|
|
|
|
this.hyperlinkParticle = this.draw.getHyperlinkParticle()
|
|
|
|
this.hyperlinkParticle = this.draw.getHyperlinkParticle()
|
|
|
|
|
|
|
|
this.listener = this.draw.getListener()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public register() {
|
|
|
|
public register() {
|
|
|
|
@ -349,6 +353,12 @@ export class CanvasEvent {
|
|
|
|
this.cut()
|
|
|
|
this.cut()
|
|
|
|
} else if (evt.ctrlKey && evt.key === KeyMap.A) {
|
|
|
|
} else if (evt.ctrlKey && evt.key === KeyMap.A) {
|
|
|
|
this.selectAll()
|
|
|
|
this.selectAll()
|
|
|
|
|
|
|
|
} else if (evt.ctrlKey && evt.key === KeyMap.S) {
|
|
|
|
|
|
|
|
const saved = this.listener.saved
|
|
|
|
|
|
|
|
if (saved) {
|
|
|
|
|
|
|
|
saved(this.save())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
evt.preventDefault()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -445,4 +455,10 @@ export class CanvasEvent {
|
|
|
|
this.isCompositing = false
|
|
|
|
this.isCompositing = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public save(): IElement[] {
|
|
|
|
|
|
|
|
const elementList = this.draw.getOriginalElementList()
|
|
|
|
|
|
|
|
const data = zipElementList(elementList)
|
|
|
|
|
|
|
|
return data
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|