Rename markup drawing methods
This matches what they are doing better.
This commit is contained in:
parent
9c7c967039
commit
6b1b46de55
30
service.js
30
service.js
@ -198,7 +198,7 @@ class BesService {
|
|||||||
*/
|
*/
|
||||||
setMarkupStyle(style) {
|
setMarkupStyle(style) {
|
||||||
this.markupStyle = style
|
this.markupStyle = style
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -358,7 +358,7 @@ class BesService {
|
|||||||
*
|
*
|
||||||
* @param {*} match Grammar checking rule match
|
* @param {*} match Grammar checking rule match
|
||||||
*/
|
*/
|
||||||
addMistakeMarkup(match) {
|
drawMistakeMarkup(match) {
|
||||||
const range = match.range
|
const range = match.range
|
||||||
const canvasPanelRect = this.canvasPanel.getBoundingClientRect()
|
const canvasPanelRect = this.canvasPanel.getBoundingClientRect()
|
||||||
const scrollX = canvasPanelRect.left
|
const scrollX = canvasPanelRect.left
|
||||||
@ -893,7 +893,7 @@ class BesService {
|
|||||||
) {
|
) {
|
||||||
this.canvasPanel.width = newCanvasWidth
|
this.canvasPanel.width = newCanvasWidth
|
||||||
this.canvasPanel.height = newCanvasHeight
|
this.canvasPanel.height = newCanvasHeight
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
}
|
}
|
||||||
if (this.isHostElementInline()) {
|
if (this.isHostElementInline()) {
|
||||||
const totalWidth =
|
const totalWidth =
|
||||||
@ -975,12 +975,12 @@ class BesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates all grammar mistake markup positions.
|
* Redraws all grammar mistake markup.
|
||||||
*/
|
*/
|
||||||
repositionAllMarkup() {
|
redrawAllMistakeMarkup() {
|
||||||
this.ctx.clearRect(0, 0, this.canvasPanel.width, this.canvasPanel.height)
|
this.ctx.clearRect(0, 0, this.canvasPanel.width, this.canvasPanel.height)
|
||||||
this.results.forEach(result => {
|
this.results.forEach(result => {
|
||||||
result.matches.forEach(match => this.addMistakeMarkup(match))
|
result.matches.forEach(match => this.drawMistakeMarkup(match))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1136,7 +1136,7 @@ class BesTreeService extends BesService {
|
|||||||
),
|
),
|
||||||
match: match
|
match: match
|
||||||
}
|
}
|
||||||
this.addMistakeMarkup(m)
|
this.drawMistakeMarkup(m)
|
||||||
matches.push(m)
|
matches.push(m)
|
||||||
})
|
})
|
||||||
this.markProofed(node, matches)
|
this.markProofed(node, matches)
|
||||||
@ -1221,7 +1221,7 @@ class BesTreeService extends BesService {
|
|||||||
this.results = this.results.filter(
|
this.results = this.results.filter(
|
||||||
result => !BesTreeService.isSameParagraph(result.element, el)
|
result => !BesTreeService.isSameParagraph(result.element, el)
|
||||||
)
|
)
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1453,7 +1453,7 @@ class BesDOMService extends BesTreeService {
|
|||||||
*/
|
*/
|
||||||
onInput() {
|
onInput() {
|
||||||
// Now that the text is done changing, we can correctly calculate markup position.
|
// Now that the text is done changing, we can correctly calculate markup position.
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
this.dismissPopup()
|
this.dismissPopup()
|
||||||
// Defer grammar-checking to reduce stress on grammar-checking server.
|
// Defer grammar-checking to reduce stress on grammar-checking server.
|
||||||
this.scheduleProofing(1000)
|
this.scheduleProofing(1000)
|
||||||
@ -1535,7 +1535,7 @@ class BesCKService extends BesTreeService {
|
|||||||
// element, it will not be updated immediately.
|
// element, it will not be updated immediately.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Now that the text is done changing, we can correctly calculate markup position.
|
// Now that the text is done changing, we can correctly calculate markup position.
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
|
|
||||||
// Defer grammar-checking to reduce stress on grammar-checking server.
|
// Defer grammar-checking to reduce stress on grammar-checking server.
|
||||||
this.scheduleProofing(1000)
|
this.scheduleProofing(1000)
|
||||||
@ -1702,7 +1702,7 @@ class BesQuillService extends BesTreeService {
|
|||||||
this.clearProofing(domElement)
|
this.clearProofing(domElement)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
this.scheduleProofing(1000)
|
this.scheduleProofing(1000)
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
@ -1888,7 +1888,7 @@ class BesPlainTextService extends BesService {
|
|||||||
),
|
),
|
||||||
match: match
|
match: match
|
||||||
}
|
}
|
||||||
this.addMistakeMarkup(m)
|
this.drawMistakeMarkup(m)
|
||||||
matches.push(m)
|
matches.push(m)
|
||||||
})
|
})
|
||||||
this.markProofed(paragraphRange, matches)
|
this.markProofed(paragraphRange, matches)
|
||||||
@ -1979,7 +1979,7 @@ class BesPlainTextService extends BesService {
|
|||||||
this.results = this.results.filter(
|
this.results = this.results.filter(
|
||||||
result => !BesPlainTextService.isSameParagraph(result.range, range)
|
result => !BesPlainTextService.isSameParagraph(result.range, range)
|
||||||
)
|
)
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2148,7 +2148,7 @@ class BesDOMPlainTextService extends BesPlainTextService {
|
|||||||
delete this.textBeforeChange
|
delete this.textBeforeChange
|
||||||
|
|
||||||
// Now that the text is done changing, we can correctly calculate markup position.
|
// Now that the text is done changing, we can correctly calculate markup position.
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
this.dismissPopup()
|
this.dismissPopup()
|
||||||
// Defer grammar-checking to reduce stress on grammar-checking server.
|
// Defer grammar-checking to reduce stress on grammar-checking server.
|
||||||
this.scheduleProofing(1000)
|
this.scheduleProofing(1000)
|
||||||
@ -2417,7 +2417,7 @@ class BesTAService extends BesPlainTextService {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Now that the text is done changing, we can correctly calculate markup position.
|
// Now that the text is done changing, we can correctly calculate markup position.
|
||||||
this.repositionAllMarkup()
|
this.redrawAllMistakeMarkup()
|
||||||
|
|
||||||
// Defer grammar-checking to reduce stress on grammar-checking server.
|
// Defer grammar-checking to reduce stress on grammar-checking server.
|
||||||
this.scheduleProofing(1000)
|
this.scheduleProofing(1000)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user