mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Add draw options for search matches (#122)
This commit is contained in:
@@ -216,6 +216,8 @@ export class View extends HTMLElement {
|
||||
#tocProgress
|
||||
#pageProgress
|
||||
#searchResults = new Map()
|
||||
#searchDraw
|
||||
#searchDrawOptions
|
||||
#cursorAutohider = new CursorAutohider(this, () =>
|
||||
this.hasAttribute('autohide-cursor'))
|
||||
isFixedLayout = false
|
||||
@@ -376,7 +378,7 @@ export class View extends HTMLElement {
|
||||
return
|
||||
}
|
||||
const range = doc ? anchor(doc) : anchor
|
||||
overlayer.add(value, range, Overlayer.outline)
|
||||
overlayer.add(value, range, this.#searchDraw, this.#searchDrawOptions)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -539,6 +541,8 @@ export class View extends HTMLElement {
|
||||
}
|
||||
async * search(opts) {
|
||||
this.clearSearch()
|
||||
this.#searchDraw = opts.draw ?? Overlayer.outline
|
||||
this.#searchDrawOptions = opts.drawOptions
|
||||
const { searchMatcher } = await import('./search.js')
|
||||
const { query, index } = opts
|
||||
const matcher = searchMatcher(textWalker,
|
||||
|
||||
Reference in New Issue
Block a user