|
@@ -95,18 +95,20 @@ export class TextSelection {
|
|
|
|
|
|
set tool (toolType) {
|
|
|
if (toolType === this._tool) return
|
|
|
- this._tool = toolType
|
|
|
- if (!markupType.includes(this.tool)) {
|
|
|
+ if (!markupType.includes(toolType)) {
|
|
|
document.removeEventListener('mousedown', this.handleMouseDown)
|
|
|
document.removeEventListener('touchstart', this.handleMouseDown)
|
|
|
document.removeEventListener('mousemove', this.handleMouseMove)
|
|
|
document.removeEventListener('touchmove', this.handleMouseMove)
|
|
|
return
|
|
|
}
|
|
|
- document.addEventListener('mousedown', this.handleMouseDown)
|
|
|
- document.addEventListener('touchstart', this.handleMouseDown)
|
|
|
- document.addEventListener('mousemove', this.handleMouseMove)
|
|
|
- document.addEventListener('touchmove', this.handleMouseMove)
|
|
|
+ if (!(markupType.includes(toolType) && markupType.includes(this.tool))) {
|
|
|
+ document.addEventListener('mousedown', this.handleMouseDown)
|
|
|
+ document.addEventListener('touchstart', this.handleMouseDown)
|
|
|
+ document.addEventListener('mousemove', this.handleMouseMove)
|
|
|
+ document.addEventListener('touchmove', this.handleMouseMove)
|
|
|
+ }
|
|
|
+ this._tool = toolType
|
|
|
}
|
|
|
|
|
|
testPoint(event: MouseEvent) {
|