MCPcopy Create free account
hub / github.com/angular/components / enter

Method enter

src/cdk/drag-drop/drop-list-ref.ts:265–283  ·  view source on GitHub ↗

* Attempts to move an item into the container. * @param item Item that was moved into the container. * @param pointerX Position of the item along the X axis. * @param pointerY Position of the item along the Y axis. * @param index Index at which the item entered. If omitted, the container

(item: DragRef, pointerX: number, pointerY: number, index?: number)

Source from the content-addressed store, hash-verified

263 * out automatically.
264 */
265 enter(item: DragRef, pointerX: number, pointerY: number, index?: number): void {
266 this._draggingStarted();
267
268 // If sorting is disabled, we want the item to return to its starting
269 // position if the user is returning it to its initial container.
270 if (index == null && this.sortingDisabled) {
271 index = this._draggables.indexOf(item);
272 }
273
274 this._sortStrategy.enter(item, pointerX, pointerY, index);
275
276 // Note that this usually happens inside `_draggingStarted` as well, but the dimensions
277 // can change when the sort strategy moves the item around inside `enter`.
278 this._cacheParentPositions();
279
280 // Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
281 this._notifyReceivingSiblings();
282 this.entered.next({item, container: this, currentIndex: this.getItemIndex(item)});
283 }
284
285 /**
286 * Removes an item from the container after it was dragged into another container by the user.

Callers

nothing calls this directly

Calls 6

_draggingStartedMethod · 0.95
_cacheParentPositionsMethod · 0.95
getItemIndexMethod · 0.95
enterMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected