Add double underline drawing for specific grammar rules
This commit is contained in:
parent
c67adcdc99
commit
b9ab9b6a64
21
service.js
21
service.js
@ -692,7 +692,9 @@ class BesService {
|
|||||||
const x2 = rect.right
|
const x2 = rect.right
|
||||||
const y = rect.bottom
|
const y = rect.bottom
|
||||||
const scale = (rect.bottom - rect.top) / 18
|
const scale = (rect.bottom - rect.top) / 18
|
||||||
this.drawAttentionRequired(x1, x2, y, amplitude, scale)
|
if (ruleId !== 'MORFOLOGIK_RULE') {
|
||||||
|
this.drawDoubleUnderline(x1, x2, y, scale)
|
||||||
|
} else this.drawAttentionRequired(x1, x2, y, amplitude, scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
markerY1 = Math.min(...match.highlights.map(rect => rect.top))
|
markerY1 = Math.min(...match.highlights.map(rect => rect.top))
|
||||||
@ -892,6 +894,23 @@ class BesService {
|
|||||||
this.ctx.stroke()
|
this.ctx.stroke()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {Number} x1 Sign left [px]
|
||||||
|
* @param {Number} x2 Sign right [px]
|
||||||
|
* @param {Number} y Sign baseline [px]
|
||||||
|
* @param {Number} scale Sign scale
|
||||||
|
*/
|
||||||
|
drawDoubleUnderline(x1, x2, y, scale) {
|
||||||
|
const dpr = window.devicePixelRatio
|
||||||
|
this.ctx.beginPath()
|
||||||
|
this.ctx.moveTo(x1 * dpr, (y - 2 * scale) * dpr)
|
||||||
|
this.ctx.lineTo(x2 * dpr, (y - 2 * scale) * dpr)
|
||||||
|
this.ctx.moveTo(x1 * dpr, (y + 1 * scale) * dpr)
|
||||||
|
this.ctx.lineTo(x2 * dpr, (y + 1 * scale) * dpr)
|
||||||
|
this.ctx.stroke()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets markup font
|
* Sets markup font
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user