Add draw options for search matches (#122)

This commit is contained in:
ArtificialSloth
2026-04-08 15:10:47 +00:00
committed by GitHub
parent 9a676796f7
commit 6e13f240f7
+5 -1
View File
@@ -216,6 +216,8 @@ export class View extends HTMLElement {
#tocProgress #tocProgress
#pageProgress #pageProgress
#searchResults = new Map() #searchResults = new Map()
#searchDraw
#searchDrawOptions
#cursorAutohider = new CursorAutohider(this, () => #cursorAutohider = new CursorAutohider(this, () =>
this.hasAttribute('autohide-cursor')) this.hasAttribute('autohide-cursor'))
isFixedLayout = false isFixedLayout = false
@@ -376,7 +378,7 @@ export class View extends HTMLElement {
return return
} }
const range = doc ? anchor(doc) : anchor const range = doc ? anchor(doc) : anchor
overlayer.add(value, range, Overlayer.outline) overlayer.add(value, range, this.#searchDraw, this.#searchDrawOptions)
} }
return return
} }
@@ -539,6 +541,8 @@ export class View extends HTMLElement {
} }
async * search(opts) { async * search(opts) {
this.clearSearch() this.clearSearch()
this.#searchDraw = opts.draw ?? Overlayer.outline
this.#searchDrawOptions = opts.drawOptions
const { searchMatcher } = await import('./search.js') const { searchMatcher } = await import('./search.js')
const { query, index } = opts const { query, index } = opts
const matcher = searchMatcher(textWalker, const matcher = searchMatcher(textWalker,