nativescript-slides
Advanced tools
Comparing version 1.5.4 to 1.5.5
@@ -29,2 +29,5 @@ import { AbsoluteLayout } from 'ui/layouts/absolute-layout'; | ||
private _indicatorsColor; | ||
static startEvent: string; | ||
static changedEvent: string; | ||
static cancelledEvent: string; | ||
pageIndicators: boolean; | ||
@@ -31,0 +34,0 @@ indicatorsColor: string; |
@@ -346,2 +346,9 @@ "use strict"; | ||
endingVelocity = 250; | ||
_this.notify({ | ||
eventName: SlideContainer.startEvent, | ||
object: _this, | ||
eventData: { | ||
currentIndex: _this.currentPanel.index | ||
} | ||
}); | ||
} | ||
@@ -358,2 +365,11 @@ else if (args.state === gestures.GestureStateTypes.ended) { | ||
_this.setupPanel(_this.currentPanel.left); | ||
_this.notify({ | ||
eventName: SlideContainer.changedEvent, | ||
object: _this, | ||
eventData: { | ||
direction: direction.left, | ||
newIndex: _this.currentPanel.index, | ||
oldIndex: _this.currentPanel.index + 1 | ||
} | ||
}); | ||
}); | ||
@@ -368,2 +384,11 @@ } | ||
_this.setupPanel(_this.currentPanel.right); | ||
_this.notify({ | ||
eventName: SlideContainer.changedEvent, | ||
object: _this, | ||
eventData: { | ||
direction: direction.right, | ||
newIndex: _this.currentPanel.index, | ||
oldIndex: _this.currentPanel.index - 1 | ||
} | ||
}); | ||
}); | ||
@@ -374,2 +399,9 @@ } | ||
if (_this.transitioning === false) { | ||
_this.notify({ | ||
eventName: SlideContainer.cancelledEvent, | ||
object: _this, | ||
eventData: { | ||
currentIndex: _this.currentPanel.index | ||
} | ||
}); | ||
_this.transitioning = true; | ||
@@ -560,2 +592,5 @@ _this.currentPanel.panel.animate({ | ||
}; | ||
SlideContainer.startEvent = "start"; | ||
SlideContainer.changedEvent = "changed"; | ||
SlideContainer.cancelledEvent = "cancelled"; | ||
return SlideContainer; | ||
@@ -562,0 +597,0 @@ }(absolute_layout_1.AbsoluteLayout)); |
@@ -14,3 +14,5 @@ import * as app from 'application'; | ||
// declare const android:any; | ||
declare var android: any; | ||
declare var com: any; | ||
declare var java: any; | ||
@@ -57,2 +59,6 @@ let LayoutParams: any; | ||
public static startEvent = "start"; | ||
public static changedEvent = "changed"; | ||
public static cancelledEvent = "cancelled"; | ||
/* page indicator stuff*/ | ||
@@ -192,4 +198,2 @@ get pageIndicators(): boolean { | ||
public constructView(constructor: boolean = false): void { | ||
this.on(AbsoluteLayout.loadedEvent, (data: any) => { | ||
@@ -355,3 +359,2 @@ if (!this._loaded) { | ||
this.currentPanel.panel.on('pan', (args: gestures.PanGestureEventData): void => { | ||
if (args.state === gestures.GestureStateTypes.began) { | ||
@@ -361,2 +364,10 @@ startTime = Date.now(); | ||
endingVelocity = 250; | ||
this.notify({ | ||
eventName: SlideContainer.startEvent, | ||
object: this, | ||
eventData: { | ||
currentIndex: this.currentPanel.index | ||
} | ||
}); | ||
} else if (args.state === gestures.GestureStateTypes.ended) { | ||
@@ -374,2 +385,12 @@ deltaTime = Date.now() - startTime; | ||
this.setupPanel(this.currentPanel.left); | ||
this.notify({ | ||
eventName: SlideContainer.changedEvent, | ||
object: this, | ||
eventData: { | ||
direction: direction.left, | ||
newIndex: this.currentPanel.index, | ||
oldIndex: this.currentPanel.index + 1 | ||
} | ||
}); | ||
}); | ||
@@ -383,2 +404,12 @@ } | ||
this.setupPanel(this.currentPanel.right); | ||
this.notify({ | ||
eventName: SlideContainer.changedEvent, | ||
object: this, | ||
eventData: { | ||
direction: direction.right, | ||
newIndex: this.currentPanel.index, | ||
oldIndex: this.currentPanel.index - 1 | ||
} | ||
}); | ||
}); | ||
@@ -390,2 +421,10 @@ } | ||
if (this.transitioning === false) { | ||
this.notify({ | ||
eventName: SlideContainer.cancelledEvent, | ||
object: this, | ||
eventData: { | ||
currentIndex: this.currentPanel.index | ||
} | ||
}); | ||
this.transitioning = true; | ||
@@ -392,0 +431,0 @@ this.currentPanel.panel.animate({ |
{ | ||
"name": "nativescript-slides", | ||
"version": "1.5.4", | ||
"version": "1.5.5", | ||
"description": "NativeScript Slides plugin.", | ||
@@ -12,3 +12,3 @@ "main": "nativescript-slides.js", | ||
"tns-ios": { | ||
"version": "2.0.0" | ||
"version": "2.0.1" | ||
} | ||
@@ -59,2 +59,7 @@ }, | ||
"url": "https://github.com/vjoao" | ||
}, | ||
{ | ||
"name": "Steve McNiven-Scott", | ||
"email": "steve@sitefinitysteve.com", | ||
"url": "https://github.com/sitefinitysteve" | ||
} | ||
@@ -61,0 +66,0 @@ ], |
@@ -89,4 +89,10 @@ # NativeScript Slides for iOS and Android | ||
#### Events | ||
- **start** - Start pan | ||
- **changed** - Transition complete | ||
- **cancelled** - User didn't complete the transition | ||
#### Angular 2 compatibility | ||
To use the slides with Angular2 and the `registerElement` from `nativescript-angular` you will want to set the `SlideContainer`'s property of `angular` to `true`. Then in your angular component in the `ngAfterViewInit`. you will want to have an instance of your slide container to call the function `constructView()`. | ||
[Follow the example](https://github.com/TheOriginalJosh/nativescript-slides/issues/37#issuecomment-224820901) | ||
@@ -157,2 +163,4 @@ #### Android Optional Attributes | ||
[Steve McNiven-Scott](https://github.com/sitefinitysteve) | ||
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: | ||
@@ -159,0 +167,0 @@ https://github.com/NathanWalker/nativescript-plugin-seed |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72832
1348
175