Compare commits

..

No commits in common. "2b54735175cf404d92b5f3e3c6ce4744096b4af6" and "a507f243268b74e9e4e4009a38121891654c56db" have entirely different histories.

View File

@ -886,11 +886,10 @@ class BesService {
* @param {Number} scale Sign scale
* @param {Number} dpr Device pixel ratio
*/
setCtxFont(scale, dpr) {
setCtxFont(scale, dpr)
{
const styles = window.getComputedStyle(this.canvasPanel)
this.ctx.font = `${styles.fontStyle} ${styles.fontWeight} ${
14 * scale * dpr
}px ${styles.fontFamily}`
this.ctx.font = `${styles.fontStyle} ${styles.fontWeight} ${14 * scale * dpr}px ${styles.fontFamily}`
}
/**
@ -945,16 +944,10 @@ class BesService {
* @param {Number} x X coordinate
* @param {Number} y Y coordinate
* @param {DOMRect} rect Rectangle
* @param {Number} tolerance Extra margin around the rectangle treated as "inside"
* @returns
*/
static isPointInRect(x, y, rect, tolerance) {
return (
rect.left - tolerance <= x &&
x < rect.right + tolerance &&
rect.top - tolerance <= y &&
y < rect.bottom + tolerance
)
static isPointInRect(x, y, rect) {
return rect.left <= x && x < rect.right && rect.top <= y && y < rect.bottom
}
/**
@ -1525,7 +1518,7 @@ class BesTreeService extends BesService {
for (let result of this.results) {
for (let m of result.matches) {
for (let rect of m.highlights) {
if (BesService.isPointInRect(x, y, rect, 5)) {
if (BesService.isPointInRect(x, y, rect)) {
pointsInRect.push({ el, match: m })
break
}
@ -2193,7 +2186,7 @@ class BesPlainTextService extends BesService {
for (let result of this.results) {
for (let m of result.matches) {
for (let rect of m.highlights) {
if (BesService.isPointInRect(x, y, rect, 5)) {
if (BesService.isPointInRect(x, y, rect)) {
pointsInRect.push({ el: result.range, match: m })
break
}
@ -2474,13 +2467,11 @@ class BesTAService extends BesPlainTextService {
parseFloat(styles.paddingRight) -
parseFloat(styles.borderRightWidth)
}px`
textElement.style.height = `${
rect.height -
textElement.style.height = `${rect.height -
parseFloat(styles.borderTopWidth) -
parseFloat(styles.paddingTop) -
parseFloat(styles.paddingBottom) -
parseFloat(styles.borderBottomWidth)
}px`
parseFloat(styles.borderBottomWidth)}px`
}
/**