diff options
Diffstat (limited to 'app/assets/javascripts/diffs/components/diff_file.vue')
-rw-r--r-- | app/assets/javascripts/diffs/components/diff_file.vue | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index a61e368249a..944084f05c9 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -25,7 +25,6 @@ export default { }, data() { return { - isActive: false, isLoadingCollapsedDiff: false, forkMessageVisible: false, }; @@ -48,12 +47,6 @@ export default { return this.isCollapsed && !this.isLoadingCollapsedDiff && !this.file.tooLarge; }, }, - mounted() { - document.addEventListener('scroll', this.handleScroll); - }, - beforeDestroy() { - document.removeEventListener('scroll', this.handleScroll); - }, methods: { ...mapActions('diffs', ['loadCollapsedDiff']), handleToggle() { @@ -65,36 +58,6 @@ export default { this.file.collapsed = !this.file.collapsed; } }, - handleScroll() { - if (!this.updating) { - requestAnimationFrame(this.scrollUpdate.bind(this)); - this.updating = true; - } - }, - scrollUpdate() { - const header = document.querySelector('.js-diff-files-changed'); - if (!header) { - this.updating = false; - return; - } - - const { top, bottom } = this.$el.getBoundingClientRect(); - const { top: topOfFixedHeader, bottom: bottomOfFixedHeader } = header.getBoundingClientRect(); - - const headerOverlapsContent = top < topOfFixedHeader && bottom > bottomOfFixedHeader; - const fullyAboveHeader = bottom < bottomOfFixedHeader; - const fullyBelowHeader = top > topOfFixedHeader; - - if (headerOverlapsContent && !this.isActive) { - this.$emit('setActive'); - this.isActive = true; - } else if (this.isActive && (fullyAboveHeader || fullyBelowHeader)) { - this.$emit('unsetActive'); - this.isActive = false; - } - - this.updating = false; - }, handleLoadCollapsedDiff() { this.isLoadingCollapsedDiff = true; |