angular2-swing
Advanced tools
+7
-5
| { | ||
| "name": "angular2-swing", | ||
| "version": "0.7.1", | ||
| "version": "0.8.0", | ||
| "description": "Angular 2 Component for Swing (Tinder style cards)", | ||
@@ -19,4 +19,7 @@ "main": "dist/index.js", | ||
| "dependencies": { | ||
| "@angular/core": "2.0.0-rc.4", | ||
| "@angular/common": "2.0.0-rc.4", | ||
| "swing": "^3.0.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@angular/core": "2.0.0-rc.5", | ||
| "@angular/common": "2.0.0-rc.5", | ||
| "es6-promise": "^3.1.2", | ||
@@ -26,5 +29,4 @@ "es6-shim": "^0.33.3", | ||
| "rxjs": "5.0.0-beta.6", | ||
| "zone.js": "0.6.12", | ||
| "swing": "^3.0.3" | ||
| "zone.js": "0.6.12" | ||
| } | ||
| } |
+15
-1
@@ -11,2 +11,3 @@ # angular2-swing | ||
| import { | ||
| StackConfig, | ||
| Stack, | ||
@@ -24,3 +25,3 @@ Card, | ||
| <div id="viewport"> | ||
| <ul class="stack" swing-stack #myswing1 (throwout)="onThrowOut($event)"> | ||
| <ul class="stack" swing-stack [stackConfig]="stackConfig" #myswing1 (throwout)="onThrowOut($event)"> | ||
| <li swing-card #mycards1 [ngClass]="c.name" *ngFor="let c of cards">{{ c.symbol }}</li> | ||
@@ -48,5 +49,15 @@ </ul> | ||
| cards: Array<any>; | ||
| stackConfig: StackConfig; | ||
| constructor() { | ||
| this.stackConfig = { | ||
| throwOutConfidence: (offset: number, targetElement: HTMLElement) => { | ||
| // you would put ur logic based on offset & targetelement to determine | ||
| // what is your throwout confidence | ||
| return 1; | ||
| }, | ||
| minThrowOutDistance: 700 // default value is 400 | ||
| }; | ||
| this.cards = [ | ||
@@ -80,2 +91,4 @@ { name: 'clubs', symbol: '♣' }, | ||
| this.swingStack.dragstart.subscribe((event: DragEvent) => console.log(event)); | ||
| this.swingStack.dragmove.subscribe((event: DragEvent) => console.log(event)); | ||
| } | ||
@@ -90,4 +103,5 @@ | ||
| ``` | ||
| See [angular2-swing-example](https://github.com/ksachdeva/angular2-swing-example) repository for the full example |
21245
2.43%1
-87.5%103
15.73%7
Infinity%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed