Skip to content

Commit

Permalink
feat(items): right click to remove item
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveVanOpstal committed Apr 13, 2016
1 parent cdf7461 commit faa9a26
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/build/items/items.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as d3 from 'd3'; //TODO: remove test
directives: [NgFor, NgClass, ItemComponent],
template: `
<template ngFor #item [ngForOf]="items" #i="index">
<item [item]="item" [ngClass]="{disabled: item.disabled}" [attr.title]="item.description" style="left: {{xScaleTime(item.time)}}px"></item>
<item [item]="item" [ngClass]="{disabled: item.disabled}" [attr.title]="item.description" style="left: {{xScaleTime(item.time)}}px" (contextmenu)="rightClicked(item)"></item>
</template>`
})

Expand Down Expand Up @@ -89,4 +89,9 @@ export class ItemsComponent implements DoCheck {
}
return -1;
}

private rightClicked(item: Object) {
this.items.splice(this.items.indexOf(item), 1);
return false; // stop context menu from appearing
}
}

0 comments on commit faa9a26

Please sign in to comment.