refactor
This commit is contained in:
		
							parent
							
								
									d1620c3bca
								
							
						
					
					
						commit
						b8a7c34228
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -68,7 +68,7 @@
 | 
				
			||||||
        return !!($intersectionStates[key] && $intersectionStates[key].isCached)
 | 
					        return !!($intersectionStates[key] && $intersectionStates[key].isCached)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      getHeight(key, $intersectionStates) {
 | 
					      getHeight(key, $intersectionStates) {
 | 
				
			||||||
        return $intersectionStates[key] && $intersectionStates[key].rect.height
 | 
					        return $intersectionStates[key] && $intersectionStates[key].height
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
| 
						 | 
					@ -77,7 +77,7 @@
 | 
				
			||||||
          return
 | 
					          return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.set({scrolledToPosition: true})
 | 
					        this.set({scrolledToPosition: true})
 | 
				
			||||||
        console.log('scrollToPosition', rect)
 | 
					        console.log('scrollToPosition', rect.top)
 | 
				
			||||||
        // TODO: there should be some cleaner way to grab the container element
 | 
					        // TODO: there should be some cleaner way to grab the container element
 | 
				
			||||||
        let container = document.getElementsByClassName('container')[0]
 | 
					        let container = document.getElementsByClassName('container')[0]
 | 
				
			||||||
        if (!container) {
 | 
					        if (!container) {
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@
 | 
				
			||||||
          let rect = getRectFromEntry(entry)
 | 
					          let rect = getRectFromEntry(entry)
 | 
				
			||||||
          newIntersectionStates[key] = {
 | 
					          newIntersectionStates[key] = {
 | 
				
			||||||
            isIntersecting: entry.isIntersecting,
 | 
					            isIntersecting: entry.isIntersecting,
 | 
				
			||||||
            rect: rect
 | 
					            height: rect.height
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if (scrollToItem === key) {
 | 
					          if (scrollToItem === key) {
 | 
				
			||||||
            this.scrollToPosition(rect)
 | 
					            this.scrollToPosition(rect)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue