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
|
#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,
|
||||||
|
|||||||
Reference in New Issue
Block a user