-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
merge dev to master #1020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
merge dev to master #1020
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7480c6a
Add renderDots for custom rendering the dots.
1f56fc4
removed extra examples in centermode
laveesingh 7e03606
added clones utilities from mixins to utils
laveesingh 421dc8c
fixed focus on select by implementing a direction function
laveesingh e10e4fb
fixed approximation in slideWidth calculation
laveesingh d8dbf5b
Merge branch 'pr1009' into dev
laveesingh 7f628d3
renamed renderDots to appendDots to follow slick naming convention
laveesingh e5d8ba7
minor modifications
laveesingh 03b0cf0
renamed a couple of variables to make more sense + minor changes
laveesingh 7605ac1
modified logic for handling odd/even cases and centermode cases more …
laveesingh 989b6bc
refactor: extracted innerSlider's and track-list's props outside of d…
laveesingh 583eb70
implemented unslick properly
laveesingh aa8304d
fixed error thrown during unslick on windowResize
laveesingh a3b7fd7
removed redundant style resetting
laveesingh 47e7c8e
added missing style prop to listProps
laveesingh 817cd79
fixed autoplay + autopause via change in props
laveesingh bbb65e5
removed mounted state
laveesingh 06801f1
put in a deprecation warning for init prop
laveesingh 071a29c
fixed variable width mode
laveesingh ec4042f
handling lost focus in case of fade
laveesingh d6d5e92
responsive lazyloading bug fixed
laveesingh b9481f2
increased verticalswiping resistance from 4 to 10
laveesingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,14 @@ import {getTrackCSS, getTrackLeft, getTrackAnimateCSS} from './trackHelper'; | |
import helpers from './helpers'; | ||
import assign from 'object-assign'; | ||
import ReactDOM from 'react-dom'; | ||
import { siblingDirection } from '../utils/trackUtils' | ||
|
||
var EventHandlers = { | ||
// Event handler for previous and next | ||
// gets called if slide is changed via arrows or dots but not swiping/dragging | ||
changeSlide: function (options) { | ||
var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide; | ||
const {slidesToScroll, slidesToShow} = this.props | ||
const {slidesToScroll, slidesToShow, centerMode, rtl} = this.props | ||
const {slideCount, currentSlide} = this.state | ||
unevenOffset = (slideCount % slidesToScroll !== 0); | ||
indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll; | ||
|
@@ -27,19 +28,32 @@ var EventHandlers = { | |
if (this.props.lazyLoad && !this.props.infinite) { | ||
targetSlide = ((currentSlide + slidesToScroll) % slideCount) + indexOffset; | ||
} | ||
} else if (options.message === 'dots' || options.message === 'children') { | ||
} else if (options.message === 'dots') { | ||
// Click on dots | ||
targetSlide = options.index * options.slidesToScroll; | ||
targetSlide = options.index * options.slidesToScroll | ||
if (targetSlide === options.currentSlide) { | ||
return; | ||
} | ||
} else if (options.message === 'children') { | ||
// Click on the slides | ||
targetSlide = options.index | ||
if (targetSlide === options.currentSlide) { | ||
return | ||
} | ||
if (this.props.infinite) { | ||
let direction = siblingDirection({currentSlide, targetSlide, slidesToShow, centerMode, slideCount, rtl}) | ||
if (targetSlide > options.currentSlide && direction === 'left') { | ||
targetSlide = targetSlide - slideCount | ||
} else if (targetSlide < options.currentSlide && direction === 'right') { | ||
targetSlide = targetSlide + slideCount | ||
} | ||
} | ||
} else if (options.message === 'index') { | ||
targetSlide = Number(options.index); | ||
if (targetSlide === options.currentSlide) { | ||
return; | ||
} | ||
} | ||
|
||
this.slideHandler(targetSlide); | ||
}, | ||
|
||
|
@@ -66,7 +80,8 @@ var EventHandlers = { | |
swipeStart: function (e) { | ||
var touches, posX, posY; | ||
|
||
if ((this.props.swipe === false) || ('ontouchend' in document && this.props.swipe === false)) { | ||
// the condition after or looked redundant | ||
if ((this.props.swipe === false)) { // || ('ontouchend' in document && this.props.swipe === false)) { | ||
return; | ||
} else if (this.props.draggable === false && e.type.indexOf('mouse') !== -1) { | ||
return; | ||
|
@@ -112,7 +127,7 @@ var EventHandlers = { | |
touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2))); | ||
var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2))); | ||
|
||
if (!this.props.verticalSwiping && !this.state.swiping && verticalSwipeLength > 4) { | ||
if (!this.props.verticalSwiping && !this.state.swiping && verticalSwipeLength > 10) { | ||
this.setState({ | ||
scrolling: true | ||
}) | ||
|
@@ -172,7 +187,7 @@ var EventHandlers = { | |
|
||
if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) | ||
{ return; } | ||
if (touchObject.swipeLength > 4) { | ||
if (touchObject.swipeLength > 10) { | ||
this.setState({ | ||
swiping: true | ||
}) | ||
|
@@ -301,21 +316,22 @@ var EventHandlers = { | |
case 'down': | ||
newSlide = this.state.currentSlide + this.getSlideCount(); | ||
slideCount = this.props.swipeToSlide ? this.checkNavigable(newSlide) : newSlide; | ||
this.state.currentDirection = 0; | ||
// this.state.currentDirection = 0; // critical: change this line with setState statement | ||
this.setState({ currentDirection: 0 }) // unverified fix of above line | ||
break; | ||
|
||
case 'right': | ||
case 'up': | ||
newSlide = this.state.currentSlide - this.getSlideCount(); | ||
slideCount = this.props.swipeToSlide ? this.checkNavigable(newSlide) : newSlide; | ||
this.state.currentDirection = 1; | ||
// this.state.currentDirection = 1; // critical: change this line with setState statement | ||
this.setState({ currentDirection: 1 }) // unverified fix of above line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @laveesingh Can you test this case and remove the unverified comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. absolutely |
||
break; | ||
|
||
default: | ||
slideCount = this.state.currentSlide; | ||
|
||
} | ||
|
||
this.slideHandler(slideCount); | ||
} else { | ||
// Adjust the track back to it's original position. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laveesingh Do we need cloneElement here ?
We can do some thing like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try and replace that.