Skip to content

Commit

Permalink
Merge pull request #74 from TheOriginalJosh/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
TheOriginalJosh authored Sep 21, 2016
2 parents fafbcda + 344fde2 commit 3571e30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 42 deletions.
47 changes: 7 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ To use the slides with Angular2 and the `registerElement` from `nativescript-ang
#### Known issues

* There appears to be a bug with the loop resulting in bad transitions going right to left.
* Currently in Android there is an known issue when a slide component inside of a scroll view.

#### How To: Load slides dynamically
You want to hook into the loaded event of the view and then create your view elements.
Expand Down Expand Up @@ -172,46 +173,6 @@ export function onSlideContainerLoaded(args) {

```

#### Smoother panning on Android (For {N} v2.0.0 and below __only__).

To achieve a much smoother drag on android simply go into the gestures.android.js file in the tns-core-modules here


`/node_modules/tns-core-modules/ui/gestures/gestures.android.js`

and change

```javascript
CustomPanGestureDetector.prototype.getMotionEventCenter = function (event) {
var count = event.getPointerCount();
var res = { x: 0, y: 0 };
for (var i = 0; i < count; i++) {
res.x += event.getX(i);
res.y += event.getY(i);
}
res.x /= (count * this.density);
res.y /= (count * this.density);
return res;
};
```

to
```javascript
CustomPanGestureDetector.prototype.getMotionEventCenter = function (event) {
var count = event.getPointerCount();
var res = { x: 0, y: 0 };
for (var i = 0; i < count; i++) {
res.x += event.getRawX();
res.y += event.getRawY();
}
res.x /= (count * this.density);
res.y /= (count * this.density);
return res;
};
```

_please note this will change the panning gesture for your entire project._


### Thanks to these awesome contributors!

Expand All @@ -223,6 +184,12 @@ _please note this will change the panning gesture for your entire project._

[Steve McNiven-Scott](https://github.com/sitefinitysteve)

[Leo Caseiro](https://github.com/leocaseiro)

[Todd Anglin](https://github.com/toddanglin)

[Andrew Lo](https://github.com/andrewlo)

And thanks to [Nathan Walker](https://github.com/NathanWalker) for setting up the {N} plugin seed that was used to help get this plugin up and running. More info can be found about it here:
https://github.com/NathanWalker/nativescript-plugin-seed

Expand Down
2 changes: 1 addition & 1 deletion nativescript-slides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export class SlideContainer extends AbsoluteLayout {
}
}

private applySwipe(pageWidth: number): void {
public applySwipe(pageWidth: number): void {
let previousDelta = -1; //hack to get around ios firing pan event after release
let endingVelocity = 0;
let startTime, deltaTime;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-slides",
"version": "2.1.5",
"version": "2.1.6",
"description": "NativeScript Slides plugin.",
"main": "nativescript-slides.js",
"nativescript": {
Expand Down

0 comments on commit 3571e30

Please sign in to comment.