JoshDSommer / nativescript-slides

A NativeScript plugin that is for Intro Tutorials, Image Carousels or any other slide functionality
Other
70 stars 32 forks source link

when use goToSlide, the last panel will still overlay on the top #126

Open wenhsiaoyi opened 5 years ago

wenhsiaoyi commented 5 years ago

add previousSlide.panel.translateX = 0 to fix the previousSlide to the reset position .

public goToSlide(index: number): void { if ( this._slideMap && this._slideMap.length > 0 && index < this._slideMap.length ) { let previousSlide = this.currentPanel; // fix right translateX value previousSlide.panel.translateX = 0; this.setupPanel(this._slideMap[index]);

  this.notify({
    eventName: SlideContainer.changedEvent,
    object: this,
    eventData: {
      direction: direction.none,
      newIndex: this.currentPanel.index,
      oldIndex: previousSlide.index
    }
  });
} else {
  // console.log('invalid index');
}

}