mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
remove xOffset
This commit is contained in:
@@ -10,11 +10,10 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const shell = require('electron').shell
|
const shell = require('electron').shell
|
||||||
|
const yOffset = 2
|
||||||
|
|
||||||
class HyperLink {
|
class HyperLink {
|
||||||
constructor(cm) {
|
constructor(cm) {
|
||||||
this.xOffset = 10
|
|
||||||
this.yOffset = 2
|
|
||||||
this.cm = cm
|
this.cm = cm
|
||||||
this.lineDiv = cm.display.lineDiv
|
this.lineDiv = cm.display.lineDiv
|
||||||
|
|
||||||
@@ -97,25 +96,18 @@
|
|||||||
const b1 = relatedTo.getBoundingClientRect()
|
const b1 = relatedTo.getBoundingClientRect()
|
||||||
const b2 = this.lineDiv.getBoundingClientRect()
|
const b2 = this.lineDiv.getBoundingClientRect()
|
||||||
const tdiv = this.tooltip
|
const tdiv = this.tooltip
|
||||||
let xOffset = this.xOffset
|
|
||||||
|
|
||||||
tdiv.style.left = (b1.left - b2.left - xOffset) + 'px'
|
tdiv.style.left = (b1.left - b2.left) + 'px'
|
||||||
this.lineDiv.appendChild(tdiv)
|
this.lineDiv.appendChild(tdiv)
|
||||||
|
|
||||||
const b3 = tdiv.getBoundingClientRect()
|
const b3 = tdiv.getBoundingClientRect()
|
||||||
if (b3.right > b2.right) {
|
const top = b1.top - b2.top - b3.height - yOffset
|
||||||
xOffset = b3.right - b2.right
|
|
||||||
tdiv.style.left = (b1.left - b2.left - xOffset) + 'px'
|
|
||||||
}
|
|
||||||
const top = b1.top - b2.top - b3.height - this.yOffset
|
|
||||||
if (top < 0) {
|
if (top < 0) {
|
||||||
tdiv.style.top = (b1.top - b2.top + b1.height + this.yOffset) + 'px'
|
tdiv.style.top = (b1.top - b2.top + b1.height + yOffset) + 'px'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tdiv.style.top = top + 'px'
|
tdiv.style.top = top + 'px'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tooltipIndicator.style.marginLeft = xOffset + 'px'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user