MCPcopy Create free account
hub / github.com/angular-dragdrop/angular-dragdrop / onDrop

Function onDrop

draganddrop.js:293–323  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

291 }
292
293 function onDrop(e) {
294 if(e.originalEvent) {
295 e.dataTransfer = e.originalEvent.dataTransfer;
296 }
297
298 if (e.preventDefault) {
299 e.preventDefault(); // Necessary. Allows us to drop.
300 }
301 if (e.stopPropagation) {
302 e.stopPropagation(); // Necessary. Allows us to drop.
303 }
304
305 var sendData = e.dataTransfer.getData('text');
306 sendData = angular.fromJson(sendData);
307
308 var dropOffset = calculateDropOffset(e);
309
310 var position = dropOffset ? {
311 x: dropOffset.x - sendData.offset.x,
312 y: dropOffset.y - sendData.offset.y
313 } : null;
314
315 determineEffectAllowed(e);
316
317 var uiOnDropFn = $parse(attr.uiOnDrop);
318 scope.$evalAsync(function() {
319 uiOnDropFn(scope, {$data: sendData.data, $event: e, $channel: sendData.channel, $position: position});
320 });
321 element.removeClass(dragEnterClass);
322 dragging = 0;
323 }
324
325 function isDragChannelAccepted(dragChannel, dropChannel) {
326 if (dropChannel === '*') {

Callers

nothing calls this directly

Calls 2

calculateDropOffsetFunction · 0.85
determineEffectAllowedFunction · 0.85

Tested by

no test coverage detected