From e1192b86aaf7018e765a5d7516cc78de9f69f661 Mon Sep 17 00:00:00 2001 From: Josh Sommer Date: Wed, 25 May 2016 23:35:57 -0400 Subject: [PATCH] clean up and bug fixes --- nativescript-slides.d.ts | 5 -- nativescript-slides.ts | 45 +++--------- package.json | 145 ++++++++++++++++++++------------------- 3 files changed, 84 insertions(+), 111 deletions(-) diff --git a/nativescript-slides.d.ts b/nativescript-slides.d.ts index 26aafc4..67956c2 100644 --- a/nativescript-slides.d.ts +++ b/nativescript-slides.d.ts @@ -24,12 +24,7 @@ export declare class SlideContainer extends AbsoluteLayout { private _angular; private _footer; private _pageIndicators; - private _pageIndicatorsColor; - private _pageIndicatorsActiveImage; - private indicatorImage; pageIndicators: boolean; - pageIndicatorsColor: string; - pageIndicatorsActiveImage: string; hasNext: boolean; hasPrevious: boolean; interval: number; diff --git a/nativescript-slides.ts b/nativescript-slides.ts index 791ffc6..51e470b 100755 --- a/nativescript-slides.ts +++ b/nativescript-slides.ts @@ -49,9 +49,7 @@ export class SlideContainer extends AbsoluteLayout { private _angular: boolean; private _footer: StackLayout; private _pageIndicators: boolean; - private _pageIndicatorsColor: Color; - private _pageIndicatorsActiveImage: string; - private indicatorImage: Image; + /* page indicator stuff*/ get pageIndicators(): boolean { return this._pageIndicators; @@ -60,23 +58,6 @@ export class SlideContainer extends AbsoluteLayout { this._pageIndicators = value; } - set pageIndicatorsColor(value: string) { - this._pageIndicatorsColor = new Color(value); - } - get pageIndicatorsColor() { - return this._pageIndicatorsColor.hex - } - - get pageIndicatorsActiveImage(): string { - return this._pageIndicatorsActiveImage; - } - set pageIndicatorsActiveImage(value: string) { - this.indicatorImage.imageSource = imageSource.fromFile(value); - this._pageIndicatorsActiveImage = value; - } - - - get hasNext(): boolean { return !!this.currentPanel.right; } @@ -177,10 +158,6 @@ export class SlideContainer extends AbsoluteLayout { if (this._pageIndicators == null) { this._pageIndicators = false; - } else { - if (this._pageIndicatorsColor == null) { - this._pageIndicatorsColor = new Color('#fff') - } } } @@ -222,7 +199,7 @@ export class SlideContainer extends AbsoluteLayout { if (this.pageIndicators) { this._footer = this.buildFooter(slides.length, 0); this.addChild(this._footer); - this.setActivePageIndicator(0); + // this.setActivePageIndicator(0); } @@ -497,6 +474,10 @@ export class SlideContainer extends AbsoluteLayout { footerInnerWrap.addChild(this.createIndicator()); i++; } + + let activeIndicator = footerInnerWrap.getChildAt(0); + activeIndicator.className = 'slide-indicator-active'; + activeIndicator.opacity = 0.9; return footerInnerWrap; } @@ -538,6 +519,7 @@ export class SlideContainer extends AbsoluteLayout { createIndicator(): Label { let indicator = new Label(); indicator.backgroundColor = new Color('#fff'); + indicator.opacity = 0.4; indicator.width = 10; indicator.height = 10; indicator.marginLeft = 2.5; @@ -551,19 +533,12 @@ export class SlideContainer extends AbsoluteLayout { this._footer.eachLayoutChild((view: View) => { if (view instanceof Label) { view.opacity = 0.4; - if (this._pageIndicatorsActiveImage != null) { - view.backgroundColor = new Color('#fff'); - view.className = 'slide-indicator-inactive'; - view.backgroundImage = null; - } + view.className = 'slide-indicator-inactive'; } }); let activeIndicator = this._footer.getChildAt(index); activeIndicator.className = 'slide-indicator-active'; activeIndicator.opacity = 0.9; - if (this._pageIndicatorsActiveImage != null) { - activeIndicator.backgroundColor = null; - activeIndicator.backgroundImage = this.pageIndicatorsActiveImage; - } + } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 69a9ab2..3a029e8 100644 --- a/package.json +++ b/package.json @@ -1,72 +1,75 @@ { - "name": "nativescript-slides", - "version": "1.4.0", - "description": "NativeScript Slides plugin.", - "main": "nativescript-slides.js", - "nativescript": { - "platforms": { - "android": "2.0.0", - "ios": "2.0.0" - } - }, - "scripts": { - "build": "tsc", - "demo.ios": "npm run preparedemo && cd demo && tns emulate ios", - "demo.android": "npm run preparedemo && cd demo && tns run android", - "preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install", - "setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..", - "livesync.ios": "cd demo && tns livesync ios --watch", - "livesync.android": "cd demo && tns livesync android --watch", - "ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch" - }, - "repository": { - "type": "git", - "url": "https://github.com/TheOriginalJosh/nativescript-slides.git" - }, - "keywords": [ - "NativeScript", - "JavaScript", - "Android", - "iOS", - "TypeScript", - "swipe slides", - "Slides", - "Carousel" - ], - "author": { - "name": "Josh Sommer", - "email": "joshdsommer@gmail.com" - }, - "contributors": [ - { - "name": "Brad Martin", - "email": "bradwaynemartin@gmail.com", - "url": "https://github.com/bradmartin" - }, - { - "name": "Obsessive Inc/Abhijith Reddy", - "email": "mabhijith95a10@gmail.com", - "url": "https://github.com/Obsessive" - }, - { - "name": "Victor Nascimento", - "email": "victormota15@gmail.com", - "url": "https://github.com/vjoao" - } - ], - "bugs": { - "url": "https://github.com/TheOriginalJosh/nativescript-slides/issues" - }, - "license": { - "type": "MIT", - "url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE" - }, - "homepage": "https://github.com/TheOriginalJosh/nativescript-slides", - "readmeFilename": "README.md", - "devDependencies": { - "typescript": "^1.8.7" - }, - "dependencies": { - "tns-platform-declarations": "^2.0.0" - } -} + "name": "nativescript-slides", + "version": "1.4.1", + "description": "NativeScript Slides plugin.", + "main": "nativescript-slides.js", + "nativescript": { + "platforms": { + "android": "2.0.0", + "ios": "2.0.0" + }, + "tns-ios": { + "version": "2.0.0" + } + }, + "scripts": { + "build": "tsc", + "demo.ios": "npm run preparedemo && cd demo && tns emulate ios", + "demo.android": "npm run preparedemo && cd demo && tns run android", + "preparedemo": "npm run build && cd demo && tns plugin remove nativescript-slides && tns plugin add .. && tns install", + "setup": "npm install && cd demo && npm install && cd .. && npm run build && cd demo && tns plugin add .. && cd ..", + "livesync.ios": "cd demo && tns livesync ios --watch", + "livesync.android": "cd demo && tns livesync android --watch", + "ios": "xcproj --project platforms/ios/YourApp.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch" + }, + "repository": { + "type": "git", + "url": "https://github.com/TheOriginalJosh/nativescript-slides.git" + }, + "keywords": [ + "NativeScript", + "JavaScript", + "Android", + "iOS", + "TypeScript", + "swipe slides", + "Slides", + "Carousel" + ], + "author": { + "name": "Josh Sommer", + "email": "joshdsommer@gmail.com" + }, + "contributors": [ + { + "name": "Brad Martin", + "email": "bradwaynemartin@gmail.com", + "url": "https://github.com/bradmartin" + }, + { + "name": "Obsessive Inc/Abhijith Reddy", + "email": "mabhijith95a10@gmail.com", + "url": "https://github.com/Obsessive" + }, + { + "name": "Victor Nascimento", + "email": "victormota15@gmail.com", + "url": "https://github.com/vjoao" + } + ], + "bugs": { + "url": "https://github.com/TheOriginalJosh/nativescript-slides/issues" + }, + "license": { + "type": "MIT", + "url": "https://github.com/TheOriginalJosh/nativescript-slides/blob/master/LICENSE" + }, + "homepage": "https://github.com/TheOriginalJosh/nativescript-slides", + "readmeFilename": "README.md", + "devDependencies": { + "typescript": "^1.8.7" + }, + "dependencies": { + "tns-platform-declarations": "^2.0.0" + } +} \ No newline at end of file