|
@@ -198,6 +198,35 @@ export default class Text extends Base {
|
|
|
x2 = pageX - (startState.clickX - this.end.x);
|
|
|
y2 = pageY - (startState.clickY - this.end.y);
|
|
|
|
|
|
+ const windowPoint1 = documentViewer.pageToWindow({
|
|
|
+ x: x1,
|
|
|
+ y: y1
|
|
|
+ }, this.page + 1, false)
|
|
|
+ const windowPoint2 = documentViewer.pageToWindow({
|
|
|
+ x: x2,
|
|
|
+ y: y2
|
|
|
+ }, this.page + 1, false)
|
|
|
+ let x = 0, y = 0
|
|
|
+ if (pageY > startState.clickY) {
|
|
|
+ y = scrollElement.offsetHeight - (windowPoint2.y - scrollElement.scrollTop - scrollElement.offsetTop)
|
|
|
+ y = y < 100 ? 5 : 0
|
|
|
+ } else if (pageY < startState.clickY) {
|
|
|
+ y = windowPoint1.y - scrollElement.scrollTop - scrollElement.offsetTop
|
|
|
+ y = y < 100 ? -5 : 0
|
|
|
+ }
|
|
|
+ if (pageX > startState.clickX) {
|
|
|
+ x = scrollElement.offsetWidth - (windowPoint2.x - scrollElement.scrollLeft - scrollElement.offsetLeft)
|
|
|
+ x = x < 100 ? 5 : 0
|
|
|
+ } else if (pageX < startState.clickX) {
|
|
|
+ x = (windowPoint1.x - scrollElement.scrollLeft - scrollElement.offsetLeft)
|
|
|
+ x = x < 100 ? -5 : 0
|
|
|
+ }
|
|
|
+
|
|
|
+ if (x || y) {
|
|
|
+ scrollElement.scrollTop += y
|
|
|
+ scrollElement.scrollLeft += x
|
|
|
+ }
|
|
|
+
|
|
|
const rect = {
|
|
|
width: Math.abs(start.x -end.x),
|
|
|
height: Math.abs(start.y -end.y)
|
|
@@ -248,6 +277,10 @@ export default class Text extends Base {
|
|
|
document.removeEventListener('mouseup', this.onMouseup)
|
|
|
document.removeEventListener('touchmove', this.onMousemove)
|
|
|
document.removeEventListener('touchend', this.onMouseup)
|
|
|
+
|
|
|
+ const documentViewer = this.layer.documentViewer
|
|
|
+ const scrollElement = documentViewer.getScrollViewElement()
|
|
|
+ scrollElement.style.touchAction = 'auto'
|
|
|
this.scrollLeft = 0
|
|
|
this.scrollTop = 0
|
|
|
|
|
@@ -413,6 +446,10 @@ export default class Text extends Base {
|
|
|
|
|
|
this.eventBus.dispatch('annotationSelected', annotationData)
|
|
|
}
|
|
|
+
|
|
|
+ const documentViewer = this.layer.documentViewer
|
|
|
+ const scrollElement = documentViewer.getScrollViewElement()
|
|
|
+ scrollElement.style.touchAction = 'none'
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -449,6 +486,7 @@ export default class Text extends Base {
|
|
|
annotationContainer.innerHTML = this.textNoteStr
|
|
|
annotationContainer.addEventListener('click', this.onClick)
|
|
|
annotationContainer.addEventListener('mousedown', this.onMousedown)
|
|
|
+ annotationContainer.addEventListener('touchstart', this.onMousedown)
|
|
|
this.annotationContainer = annotationContainer
|
|
|
}
|
|
|
|