MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / selectEntry

Method selectEntry

ui/media/js/searchable-models.js:355–380  ·  view source on GitHub ↗
(path, dispatchEvent = true)

Source from the content-addressed store, hash-verified

353 }
354
355 selectEntry(path, dispatchEvent = true) {
356 if (path !== undefined) {
357 const entries = this.modelElements
358
359 for (const elem of entries) {
360 if (elem.dataset.path == path) {
361 this.saveCurrentSelection(elem, elem.innerText, elem.dataset.path, dispatchEvent)
362 this.highlightedModelEntry = elem
363 elem.scrollIntoView({ block: "nearest" })
364 break
365 }
366 }
367 }
368
369 if (this.currentSelection.elem !== undefined) {
370 // select the previous element
371 if (this.highlightedModelEntry !== undefined && this.highlightedModelEntry != this.currentSelection.elem) {
372 this.highlightedModelEntry.classList.remove("selected")
373 }
374 this.currentSelection.elem.classList.add("selected")
375 this.highlightedModelEntry = this.currentSelection.elem
376 this.currentSelection.elem.scrollIntoView({ block: "nearest" })
377 } else {
378 this.selectFirstFile()
379 }
380 }
381
382 highlightModelAtPosition(e) {
383 let elem = document.elementFromPoint(e.clientX, e.clientY)

Callers 4

valueMethod · 0.95
modelListFocusMethod · 0.95
showModelListMethod · 0.95
createDropdownMethod · 0.95

Calls 3

saveCurrentSelectionMethod · 0.95
selectFirstFileMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected