Skip to content

Commit a75445e

Browse files
committed
fixing drag problems with page indicators showing.
1 parent 16f355a commit a75445e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

nativescript-slides.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export class SlideContainer extends AbsoluteLayout {
183183

184184
if (this.pageIndicators) {
185185
this._footer = this.buildFooter(slides.length, 0);
186+
this.setActivePageIndicator(0);
186187
this.insertChild(this._footer, this.getChildrenCount());
187188
}
188189

@@ -454,19 +455,21 @@ export class SlideContainer extends AbsoluteLayout {
454455
footerInnerWrap.height = 50;
455456

456457
this.setwidthPercent(footerInnerWrap, 100);
457-
AbsoluteLayout.setLeft(footerInnerWrap, 0);
458458
AbsoluteLayout.setTop(footerInnerWrap, 0);
459459

460460
footerInnerWrap.orientation = 'horizontal';
461461
footerInnerWrap.verticalAlignment = 'top';
462462
footerInnerWrap.horizontalAlignment = 'center';
463+
footerInnerWrap.width = (this._pageWidth / 2);
463464

464465
let index = 0;
465466
while (index < pageCount) {
466467
footerInnerWrap.addChild(this.createIndicator(index));
467468
index++;
468469
}
469470

471+
let pageIndicatorsLeftOffset = this.pageWidth / 4;
472+
AbsoluteLayout.setLeft(footerInnerWrap, pageIndicatorsLeftOffset);
470473

471474
footerInnerWrap.marginTop = <any>this._pagerOffset;
472475

@@ -559,23 +562,15 @@ export class SlideContainer extends AbsoluteLayout {
559562
}
560563

561564
setActivePageIndicator(index: number) {
562-
563-
564565
let indicatorsToDeactivate = (<any>this._footer).getElementsByClassName(SLIDE_INDICATOR_ACTIVE);
565-
// if (indicatorToDeactivate) {
566-
// indicatorToDeactivate.classList.toggle(SLIDE_INDICATOR_INACTIVE);
567-
// console.log(indicatorToDeactivate);
568-
// }
566+
569567
indicatorsToDeactivate.forEach(activeIndicator => {
570-
console.log(activeIndicator);
571-
// activeIndicator.className = activeIndicator.className.replace('slide-indicator-active ', 'slide-indicator-inactive ');
572568
activeIndicator.classList.remove(SLIDE_INDICATOR_ACTIVE);
573569
activeIndicator.classList.add(SLIDE_INDICATOR_INACTIVE);
574570
});
575571

576572
let activeIndicator = (<any>this._footer).getElementsByClassName(SLIDE_INDICATOR_INACTIVE)[index];
577573
activeIndicator.classList.remove(SLIDE_INDICATOR_INACTIVE);
578574
activeIndicator.classList.add(SLIDE_INDICATOR_ACTIVE);
579-
console.log(JSON.stringify(activeIndicator));
580575
}
581576
}

0 commit comments

Comments
 (0)