diff --git a/.travis.yml b/.travis.yml index 4722279..ee129f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,12 +21,12 @@ deploy: api_key: $GITHUB_TOKEN file_glob: true file: "pixi-yoo-ai-*.tgz" - skip_cleanup: true + cleanup: true on: tags: true - provider: npm edge: true - skip_cleanup: true + cleanup: true email: "contact@pastila.org" api_key: $NPM_TOKEN on: diff --git a/CHANGELOG.md b/CHANGELOG.md index a79fa1b..0eedaa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. -# 0.0.37 - 2020-12-06 +# 0.0.39 - 2020-12-20 +- Fixed: All scroll methods of the lists now works with the `animated` flag as expected. + +# 0.0.38 - 2020-12-06 - Feature: Added setters for `centerX` and `centerY` # 0.0.37 - 2020-11-30 diff --git a/package.json b/package.json index e215e04..a95a59a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pixi-yoo-ai", - "version": "0.0.38", + "version": "0.0.39", "description": "Yoo Ai. Extensive UI library for PixiJS v5", "author": "Ilya Malanin", "license": "MIT", diff --git a/src/yooai/containers/List.ts b/src/yooai/containers/List.ts index 96e358f..f986095 100644 --- a/src/yooai/containers/List.ts +++ b/src/yooai/containers/List.ts @@ -55,6 +55,7 @@ export class List extends VirtualScrollList { this.scrollTo( index * (this.rowHeight + this.verticalGap), this.horizontalScrollPosition, + animated ); } @@ -62,6 +63,7 @@ export class List extends VirtualScrollList { this.scrollTo( this.pageHeight * index, this.horizontalScrollPosition, + animated ); } diff --git a/src/yooai/containers/TileList.ts b/src/yooai/containers/TileList.ts index 5d3d96c..50cdaa0 100644 --- a/src/yooai/containers/TileList.ts +++ b/src/yooai/containers/TileList.ts @@ -49,7 +49,7 @@ export class TileList extends List { this.componentWidth = (this.horizontalGap + this.columnWidth) * value - this.horizontalGap + this.contentPadding * 2; } - public scrollToIndex(index: number): void { + public scrollToIndex(index: number, animated: boolean = true): void { let verticalPosition: number = this.verticalScrollPosition; let horizontalPosition: number = this.horizontalScrollPosition; switch (this._direction) { @@ -60,7 +60,7 @@ export class TileList extends List { horizontalPosition = Math.floor(index / this.rowsCount) * (this.columnWidth + this.horizontalGap); break; } - this.scrollTo(verticalPosition, horizontalPosition); + this.scrollTo(verticalPosition, horizontalPosition, animated); } public scrollToPage(index: number, animated = true): void { @@ -74,7 +74,7 @@ export class TileList extends List { horizontalPosition = this.pageWidth * index; break; } - this.scrollTo(verticalPosition, horizontalPosition); + this.scrollTo(verticalPosition, horizontalPosition, animated); } public scrollPageUp(animated = true): void { @@ -109,10 +109,10 @@ export class TileList extends List { ); } - protected scrollBy(verticalOffset: number, horizontalOffset: number, animated: boolean) { + protected scrollBy(verticalOffset: number, horizontalOffset: number, animated: boolean = true) { const verticalPosition: number = this.verticalScrollPosition + verticalOffset; const horizontalPosition: number = this.horizontalScrollPosition + horizontalOffset; - this.scrollTo(verticalPosition, horizontalPosition); + this.scrollTo(verticalPosition, horizontalPosition, animated); } protected calculateDrawListIndexes(): { startIndex: number; endIndex: number } { diff --git a/src/yooai/containers/VirtualScrollList.ts b/src/yooai/containers/VirtualScrollList.ts index fc0105d..56fbee3 100644 --- a/src/yooai/containers/VirtualScrollList.ts +++ b/src/yooai/containers/VirtualScrollList.ts @@ -13,14 +13,6 @@ import { import {BaseScrollPane} from "./BaseScrollPane"; export abstract class VirtualScrollList extends BaseScrollPane { - public get animated(): boolean { - return this._animated; - } - - public set animated(value: boolean) { - this._animated = value; - } - public get maxSelectedItemsCount(): number { return this._maxSelectedItemsCount; } @@ -341,43 +333,47 @@ export abstract class VirtualScrollList extends BaseScrollPane { return index !== -1 && this._selectedIndices.indexOf(index) !== -1; } - public scrollToSelected(): void { - this.scrollToIndex(this.selectedIndex); + public scrollToSelected(animated: boolean = true): void { + this.scrollToIndex(this.selectedIndex, animated); } - public abstract scrollToIndex(index: number): void; + public abstract scrollToIndex(index: number, animated: boolean): void; - public abstract scrollToPage(index: number): void; + public abstract scrollToPage(index: number, animated: boolean): void; - public scrollPageUp(): void { + public scrollPageUp(animated: boolean = true): void { this.scrollTo( this.verticalScrollPosition - this.pageHeight, this.horizontalScrollPosition, + animated, ); } - public scrollPageDown(): void { + public scrollPageDown(animated: boolean = true): void { this.scrollTo( this.verticalScrollPosition + this.pageHeight, this.horizontalScrollPosition, + animated, ); } - public scrollRowUp(): void { + public scrollRowUp(animated: boolean = true): void { this.scrollTo( this.verticalScrollPosition - this.rowHeight - this.verticalGap, this.horizontalScrollPosition, + animated, ); } - public scrollRowDown(): void { + public scrollRowDown(animated: boolean = true): void { this.scrollTo( this.verticalScrollPosition + this.rowHeight + this.verticalGap, this.horizontalScrollPosition, + animated ); } - public scrollTo(verticalPosition: number, horizontalPosition: number) { + public scrollTo(verticalPosition: number, horizontalPosition: number, animated: boolean = true) { verticalPosition = Math.min(Math.max(0, verticalPosition), this.maxVerticalScrollPosition); horizontalPosition = Math.min(Math.max(0, horizontalPosition), this.maxHorizontalScrollPosition); @@ -385,7 +381,7 @@ export abstract class VirtualScrollList extends BaseScrollPane { return; } - if (this._animated) { + if (animated) { const distance = Math.sqrt( Math.pow(this.verticalScrollPosition - verticalPosition, 2) + Math.pow(this.horizontalScrollPosition - horizontalPosition, 2),