|
@@ -36,6 +36,7 @@ export default class Text extends Base {
|
|
|
this.initial = false
|
|
|
this.outline = null
|
|
|
|
|
|
+ this.rect = null
|
|
|
this.start = null
|
|
|
this.end = null
|
|
|
|
|
@@ -62,7 +63,7 @@ export default class Text extends Base {
|
|
|
render () {
|
|
|
this.renderTextElement()
|
|
|
this.renderTextEditor()
|
|
|
-
|
|
|
+
|
|
|
this.container.append(this.annotationContainer)
|
|
|
}
|
|
|
|
|
@@ -231,6 +232,9 @@ export default class Text extends Base {
|
|
|
|
|
|
this.annotationContainer.style.top = rect.top + 'px'
|
|
|
this.annotationContainer.style.left = rect.left + 'px'
|
|
|
+
|
|
|
+ this.textEditorContainer.style.top = rect.top + 28 + 'px'
|
|
|
+ this.textEditorContainer.style.left = rect.left + 16 + 'px'
|
|
|
}
|
|
|
|
|
|
rectCalc ({start, end}) {
|
|
@@ -294,11 +298,10 @@ export default class Text extends Base {
|
|
|
this.eventBus.dispatch('closeTextEditor', event.target.closest('.annotation.text'))
|
|
|
if (this.popShow) return
|
|
|
this.popShow = true
|
|
|
- this.annotationContainer.append(this.textEditorContainer)
|
|
|
- this.annotationContainer.style.zIndex = 7
|
|
|
+ this.layer.pageDiv.append(this.textEditorContainer)
|
|
|
this.textEditorElement.focus()
|
|
|
keepLastIndex(this.textEditorElement)
|
|
|
- onClickOutside([this.annotationContainer], this.handleClickOutside.bind(this))
|
|
|
+ onClickOutside([this.annotationContainer, this.textEditorContainer], this.handleClickOutside.bind(this))
|
|
|
}
|
|
|
|
|
|
updateTool () {
|
|
@@ -337,6 +340,8 @@ export default class Text extends Base {
|
|
|
|
|
|
const rect = this.rectCalc({start, end})
|
|
|
|
|
|
+ this.rect = rect
|
|
|
+
|
|
|
let annotationContainer = document.createElement('div')
|
|
|
annotationContainer.id = annotation.name
|
|
|
annotationContainer.className = 'annotation text'
|
|
@@ -360,8 +365,10 @@ export default class Text extends Base {
|
|
|
this.textEditorContainer = textEditorContainer
|
|
|
this.setCss(textEditorContainer, {
|
|
|
position: 'absolute',
|
|
|
- left: '16px',
|
|
|
- top: '28px',
|
|
|
+ left: this.rect.left + 16 + 'px',
|
|
|
+ top: this.rect.top + 28 + 'px',
|
|
|
+ zIndex: 2,
|
|
|
+ color: this.annotation.color.getColor() || '#FF0000',
|
|
|
border: '2px solid',
|
|
|
borderColor: this.annotation.color || '#FF0000',
|
|
|
outline: 'none',
|