diff --git a/README.md b/README.md index 8ecf49a..bad3a2b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ npm install angular2-swing --save import {Component, ViewChild, ViewChildren, QueryList} from '@angular/core'; import { + StackConfig, Stack, Card, ThrowEvent, @@ -20,7 +21,7 @@ import { directives: [SwingStackComponent, SwingCardComponent], template: `
-
@@ -43,9 +44,19 @@ export class App { @ViewChildren('mycards1') swingCards: QueryList; cards: Array; + 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 = [ { name: 'clubs', symbol: '♣' }, { name: 'diamonds', symbol: '♦' }, @@ -74,6 +85,8 @@ export class App { (event: ThrowEvent) => console.log('Manual hook: ', event)); this.swingStack.dragstart.subscribe((event: DragEvent) => console.log(event)); + + this.swingStack.dragmove.subscribe((event: DragEvent) => console.log(event)); } // This method is called by hooking up the event @@ -83,6 +96,7 @@ export class App { } } + ``` See [angular2-swing-example](https://github.com/ksachdeva/angular2-swing-example) repository for the full example