@angular/cdk/drag-drop#CdkDragMove TypeScript Examples
The following examples show how to use
@angular/cdk/drag-drop#CdkDragMove.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: gantt-table.component.ts From ngx-gantt with MIT License | 6 votes |
dragMoved(event: CdkDragMove, column?: NgxGanttTableColumnComponent) {
const target = event.source.element.nativeElement;
const left = target.getBoundingClientRect().left;
let originWidth: number;
let movedWidth: number;
let minWidth: number;
if (column) {
originWidth = parseInt(column.columnWidth, 10);
movedWidth = originWidth + (left - this.dragStartLeft);
minWidth = minColumnWidth;
} else {
originWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
movedWidth = originWidth + (left - this.dragStartLeft);
minWidth = minColumnWidth * this.columnList.length;
}
this.dragFixed({
target,
originWidth,
movedWidth,
minWidth
});
this.showAuxiliaryLine(event);
}
Example #2
Source File: ngx-chess-board.component.ts From ngx-chess-board with MIT License | 5 votes |
dragMoved($event: CdkDragMove<any>) {
let x = ($event.pointerPosition.x - $event.source.getRootElement().parentElement.getBoundingClientRect().left) - (this.pieceSize / 2);
let y = ($event.pointerPosition.y - $event.source.getRootElement().parentElement.getBoundingClientRect().top) - (this.pieceSize / 2);
$event.source.getRootElement().style.transform = 'translate3d(' + x + 'px, '
+ (y) + 'px,0px)';
}
Example #3
Source File: gantt-table.component.ts From ngx-gantt with MIT License | 5 votes |
private showAuxiliaryLine(event: CdkDragMove) {
const tableRect = this.elementRef.nativeElement.getBoundingClientRect();
this.draglineElementRef.nativeElement.style.left = `${(event.event as any).clientX - tableRect.left}px`;
this.draglineElementRef.nativeElement.style.display = 'block';
}