PanoramaCollection.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import common from './common.js'
  2. import IndexedCollection from './IndexedCollection.js'
  3. import math from './math.js'
  4. class PanoramaCollection extends IndexedCollection {
  5. constructor() {
  6. super()
  7. this.neighbourMap = {}
  8. this.map = null
  9. this.animatePanoId = null
  10. }
  11. getIndex(pano) {
  12. return pano.id
  13. }
  14. find(e, t) {
  15. var i = common.filterAll(this.list, e)
  16. return 0 === i.length
  17. ? null
  18. : (t &&
  19. t.forEach(function (e) {
  20. i = common.stableSort(i, e)
  21. }),
  22. i[0])
  23. }
  24. lowestByScore(e, t, i) {
  25. return this.findRankedByScore(0, e, t, i)
  26. }
  27. findRankedByScore(e, t, i, n) {
  28. n && ((n.candidates = null), (n.pano = null)), e || (e = 0)
  29. var r = common.sortByScore(this.list, t, i)
  30. return !r || 0 === r.length || e >= r.length ? null : (n && ((n.candidates = r), (n.pano = r[e].item)), r[e].item)
  31. }
  32. }
  33. export default PanoramaCollection