Last active
April 9, 2018 08:10
-
-
Save dbismut/f2e9e581c0feaf13e66480740bd90935 to your computer and use it in GitHub Desktop.
Part 3 - Adding scale to transition from drag and compensate viewport scroll in this.to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onExit = () => { | |
this.removeListeners(); | |
if (!this.preview) return; | |
const scale = 1 - this.state.dragProgress * (1 - DRAG_MINIMUM_SCALE); | |
this.from = { | |
top: 0, | |
height: this.post.offsetHeight, | |
width: this.post.offsetWidth, | |
borderRadius: this.postStyler.get('borderRadius'), | |
scale, // add scale right there | |
scrollTop: windowScroll.get('top') | |
}; | |
this.to = { | |
...this.getPreviewStyleAndPosition(), | |
scrollTop: 0 | |
}; | |
// setting destination top to compensate | |
// for the drag | |
if (this.isTransitioningFromDrag) { | |
this.to.top += windowScroll.get('top'); | |
} | |
/* same code */ | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment