MCPcopy
hub / github.com/aosabook/500lines / dragStart

Function dragStart

blockcode/code/drag.js:8–25  ·  view source on GitHub ↗
(evt)

Source from the content-addressed store, hash-verified

6 var scriptBlocks = []; // Blocks in the script, sorted by position
7
8 function dragStart(evt){
9 if (!matches(evt.target, '.block')) return;
10 if (matches(evt.target, '.menu .block')){
11 dragType = 'menu';
12 }else{
13 dragType = 'script';
14 }
15 evt.target.classList.add('dragging');
16 dragTarget = evt.target;
17 scriptBlocks = [].slice.call(document.querySelectorAll('.script .block:not(.dragging)'));
18 // For dragging to take place in Firefox, we have to set this, even if we don't use it
19 evt.dataTransfer.setData('text/html', evt.target.outerHTML);
20 if (matches(evt.target, '.menu .block')){
21 evt.dataTransfer.effectAllowed = 'copy';
22 }else{
23 evt.dataTransfer.effectAllowed = 'move';
24 }
25 }
26
27
28 function dragEnter(evt){

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected