@angular/cdk/drag-drop#CdkDragEnd TypeScript Examples

The following examples show how to use @angular/cdk/drag-drop#CdkDragEnd. 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 vote down vote up
columnDragEnded(event: CdkDragEnd, column: NgxGanttTableColumnComponent) {
        const target = event.source.element.nativeElement;
        const left = target.getBoundingClientRect().left;
        const width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
        const columnWidth = Math.max(width || 0, minColumnWidth);
        column.columnWidth = coerceCssPixelValue(columnWidth);
        if (this.gantt.table) {
            this.gantt.table.columnChanges.emit({ columns: this.columnList });
        }

        this.hideAuxiliaryLine();
        event.source.reset();
    }
Example #2
Source File: gantt-table.component.ts    From ngx-gantt with MIT License 6 votes vote down vote up
tableDragEnded(event: CdkDragEnd) {
        const target = event.source.element.nativeElement;
        const left = target.getBoundingClientRect().left;
        const tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
        const dragWidth = left - this.dragStartLeft;
        this.columnList.forEach((column) => {
            const lastColumnWidth = parseInt(column.columnWidth, 10);
            const distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
            const columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
            column.columnWidth = coerceCssPixelValue(columnWidth);
        });

        if (this.gantt.table) {
            this.gantt.table.columnChanges.emit({ columns: this.columnList });
        }

        this.hideAuxiliaryLine();
        event.source.reset();
    }
Example #3
Source File: animation-drag-end-processor.ts    From ngx-chess-board with MIT License 5 votes vote down vote up
dragEnded(event: CdkDragEnd, disabling: boolean, startTrans: string) {
        if (!disabling) {
            if (startTrans) {
                event.source._dragRef.getRootElement().style.transform = startTrans;
            }
        }
    }
Example #4
Source File: default-drag-end-processor.ts    From ngx-chess-board with MIT License 5 votes vote down vote up
dragEnded(event: CdkDragEnd, disabling: boolean, startTrans: string) {
        event.source.reset();
        event.source.element.nativeElement.style.zIndex = '0';
        event.source.element.nativeElement.style.pointerEvents = 'auto';
        event.source.element.nativeElement.style.touchAction = 'auto';
    }
Example #5
Source File: drag-end-strategy.ts    From ngx-chess-board with MIT License 5 votes vote down vote up
public process(event: CdkDragEnd, disabling: boolean, startTrans: string): void {
        this.dragEndProcessor.dragEnded(event, disabling, startTrans);
    }
Example #6
Source File: ngx-chess-board.component.ts    From ngx-chess-board with MIT License 5 votes vote down vote up
dragEnded(event: CdkDragEnd): void {
        this.isDragging = false;
        this.engineFacade.dragEndStrategy.process(
            event,
            this.engineFacade.moveDone,
            this.startTransition
        );
    }