nativescript-slides
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -24,2 +24,3 @@ import { AbsoluteLayout } from 'ui/layouts/absolute-layout'; | ||
private _pageIndicators; | ||
private _slideMap; | ||
static START_EVENT: string; | ||
@@ -47,2 +48,3 @@ static CHANGED_EVENT: string; | ||
private positionPanels(panel); | ||
goToSlide(index: number): void; | ||
private applySwipe(pageWidth); | ||
@@ -49,0 +51,0 @@ private showRightSlide(panelMap, offset?, endingVelocity?); |
@@ -269,2 +269,10 @@ "use strict"; | ||
}; | ||
SlideContainer.prototype.goToSlide = function (index) { | ||
if (this._slideMap.length > 0 && index < this._slideMap.length) { | ||
this.setupPanel(this._slideMap[index]); | ||
} | ||
else { | ||
console.log('invalid index'); | ||
} | ||
}; | ||
SlideContainer.prototype.applySwipe = function (pageWidth) { | ||
@@ -448,5 +456,6 @@ var _this = this; | ||
SlideContainer.prototype.buildSlideMap = function (views) { | ||
var slideMap = []; | ||
var _this = this; | ||
this._slideMap = []; | ||
views.forEach(function (view, index) { | ||
slideMap.push({ | ||
_this._slideMap.push({ | ||
panel: view, | ||
@@ -456,13 +465,13 @@ index: index, | ||
}); | ||
slideMap.forEach(function (mapping, index) { | ||
if (slideMap[index - 1] != null) | ||
mapping.left = slideMap[index - 1]; | ||
if (slideMap[index + 1] != null) | ||
mapping.right = slideMap[index + 1]; | ||
this._slideMap.forEach(function (mapping, index) { | ||
if (_this._slideMap[index - 1] != null) | ||
mapping.left = _this._slideMap[index - 1]; | ||
if (_this._slideMap[index + 1] != null) | ||
mapping.right = _this._slideMap[index + 1]; | ||
}); | ||
if (this.loop) { | ||
slideMap[0].left = slideMap[slideMap.length - 1]; | ||
slideMap[slideMap.length - 1].right = slideMap[0]; | ||
this._slideMap[0].left = this._slideMap[this._slideMap.length - 1]; | ||
this._slideMap[this._slideMap.length - 1].right = this._slideMap[0]; | ||
} | ||
return slideMap[0]; | ||
return this._slideMap[0]; | ||
}; | ||
@@ -469,0 +478,0 @@ SlideContainer.prototype.triggerStartEvent = function () { |
@@ -62,2 +62,3 @@ require("nativescript-dom"); | ||
private _pageIndicators: boolean; | ||
private _slideMap: ISlideMap[]; | ||
@@ -282,3 +283,9 @@ public static START_EVENT = 'start'; | ||
} | ||
public goToSlide(index: number): void { | ||
if (this._slideMap.length > 0 && index < this._slideMap.length) { | ||
this.setupPanel(this._slideMap[index]); | ||
} else { | ||
console.log('invalid index'); | ||
} | ||
} | ||
private applySwipe(pageWidth: number): void { | ||
@@ -494,5 +501,5 @@ let previousDelta = -1; //hack to get around ios firing pan event after release | ||
private buildSlideMap(views: StackLayout[]) { | ||
let slideMap: ISlideMap[] = []; | ||
this._slideMap = []; | ||
views.forEach((view: StackLayout, index: number) => { | ||
slideMap.push({ | ||
this._slideMap.push({ | ||
panel: view, | ||
@@ -502,14 +509,14 @@ index: index, | ||
}); | ||
slideMap.forEach((mapping: ISlideMap, index: number) => { | ||
if (slideMap[index - 1] != null) | ||
mapping.left = slideMap[index - 1]; | ||
if (slideMap[index + 1] != null) | ||
mapping.right = slideMap[index + 1]; | ||
this._slideMap.forEach((mapping: ISlideMap, index: number) => { | ||
if (this._slideMap[index - 1] != null) | ||
mapping.left = this._slideMap[index - 1]; | ||
if (this._slideMap[index + 1] != null) | ||
mapping.right = this._slideMap[index + 1]; | ||
}); | ||
if (this.loop) { | ||
slideMap[0].left = slideMap[slideMap.length - 1]; | ||
slideMap[slideMap.length - 1].right = slideMap[0]; | ||
this._slideMap[0].left = this._slideMap[this._slideMap.length - 1]; | ||
this._slideMap[this._slideMap.length - 1].right = this._slideMap[0]; | ||
} | ||
return slideMap[0]; | ||
return this._slideMap[0]; | ||
} | ||
@@ -516,0 +523,0 @@ |
{ | ||
"name": "nativescript-slides", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "NativeScript Slides plugin.", | ||
@@ -5,0 +5,0 @@ "main": "nativescript-slides.js", |
# NativeScript Slides for iOS and Android | ||
[![npm](https://img.shields.io/npm/v/nativescript-slides.svg)](https://www.npmjs.com/package/nativescript-slides) | ||
[![npm](https://img.shields.io/npm/dt/nativescript-slides.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-slides) | ||
### _The plugin formally known as nativescript-intro-slides_ | ||
@@ -3,0 +7,0 @@ |
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
69929
1246
235