Skip to content

Commit 0352274

Browse files
committed
swipeSpeed property is added.
1 parent 3abee47 commit 0352274

File tree

5 files changed

+57
-38
lines changed

5 files changed

+57
-38
lines changed

app/App_Resources/Android/app.gradle

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
// Add your native dependencies here:
2-
3-
// Uncomment to add recyclerview-v7 dependency
4-
//dependencies {
5-
// compile 'com.android.support:recyclerview-v7:+'
6-
//}
7-
8-
android {
9-
defaultConfig {
10-
generatedDensities = []
11-
applicationId = "__PACKAGE__"
12-
}
13-
aaptOptions {
14-
additionalParameters "--no-version-vectors"
15-
}
16-
}
1+
// Add your native dependencies here:
2+
3+
// Uncomment to add recyclerview-v7 dependency
4+
//dependencies {
5+
// compile 'com.android.support:recyclerview-v7:+'
6+
//}
7+
8+
android {
9+
defaultConfig {
10+
generatedDensities = []
11+
applicationId = "org.nativescript.nativescriptpackagr"
12+
}
13+
aaptOptions {
14+
additionalParameters "--no-version-vectors"
15+
}
16+
}

app/home/home.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<StackLayout>
2-
<slides loop="true" [pageIndicators]="true">
2+
<slides loop="true" [pageIndicators]="true" [swipeSpeed]="20">
33
<slide class="slide-1">
4-
<Label text="Slide 1" textWrap="true"></Label>
4+
<Label text="Slide 111111" textWrap="true"></Label>
55
</slide>
66
<slide class="slide-2">
77
<Label text="Slide 2" textWrap="true"></Label>

lib/src/slides/slides.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
6262
@Input("footerMarginTop") footerMarginTop: number;
6363
@Input("loop") loop: boolean;
6464
@Input("pageIndicators") pageIndicators: boolean;
65+
@Input("swipeSpeed") swipeSpeed: number;
6566
@Input("class") cssClass: string = "";
6667
@Input() zoomEnabled = false;
6768
@Input("autoInit") autoInit: boolean = true;
@@ -100,6 +101,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
100101
ngOnInit() {
101102
this.loop = this.loop ? this.loop : false;
102103
this.pageIndicators = this.pageIndicators ? this.pageIndicators : false;
104+
this.swipeSpeed = this.swipeSpeed ? this.swipeSpeed : 3;
103105
this.pageWidth = this.pageWidth
104106
? this.pageWidth
105107
: platform.screen.mainScreen.widthDIPs;
@@ -390,7 +392,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
390392
// if velocityScrolling is enabled then calculate the velocitty
391393

392394
// swiping left to right.
393-
if (args.deltaX > this.pageWidth / 3) {
395+
if (args.deltaX > this.pageWidth / this.swipeSpeed) {
394396
if (this.hasPrevious) {
395397
this.transitioning = true;
396398
this.showLeftSlide(
@@ -410,7 +412,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
410412
return;
411413
}
412414
// swiping right to left
413-
else if (args.deltaX < -this.pageWidth / 3) {
415+
else if (args.deltaX < -this.pageWidth / this.swipeSpeed) {
414416
if (this.hasNext) {
415417
this.transitioning = true;
416418
this.showRightSlide(

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"id": "org.nativescript.nativescriptpackagr",
88
"tns-ios": {
99
"version": "4.2.0"
10+
},
11+
"tns-android": {
12+
"version": "4.2.0"
1013
}
1114
},
1215
"scripts": {
@@ -38,4 +41,4 @@
3841
"ng-packagr": "^3.0.1",
3942
"typescript": "~2.7.2"
4043
}
41-
}
44+
}

tsconfig.json

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
{
2-
"compilerOptions": {
3-
"module": "commonjs",
4-
"target": "es5",
5-
"experimentalDecorators": true,
6-
"emitDecoratorMetadata": true,
7-
"noEmitHelpers": true,
8-
"noEmitOnError": true,
9-
"lib": ["es6", "dom", "es2015.iterable"],
10-
"baseUrl": ".",
11-
"paths": {
12-
"~/*": ["app/*"],
13-
"nativescript-ngx-slides": ["./lib/index.ts"],
14-
"*": ["./node_modules/tns-core-modules/*", "./node_modules/*"]
15-
}
16-
},
17-
"exclude": ["node_modules", "platforms"]
18-
}
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"experimentalDecorators": true,
6+
"emitDecoratorMetadata": true,
7+
"noEmitHelpers": true,
8+
"noEmitOnError": true,
9+
"lib": [
10+
"es6",
11+
"dom",
12+
"es2015.iterable"
13+
],
14+
"baseUrl": ".",
15+
"paths": {
16+
"~/*": [
17+
"app/*"
18+
],
19+
"nativescript-ngx-slides": [
20+
"./lib/index.ts"
21+
],
22+
"*": [
23+
"./node_modules/tns-core-modules/*",
24+
"./node_modules/*"
25+
]
26+
}
27+
},
28+
"exclude": [
29+
"node_modules",
30+
"platforms"
31+
]
32+
}

0 commit comments

Comments
 (0)