MCPcopy Index your code
hub / github.com/csev/py4e / onDragStart

Function onDragStart

tools/pythonauto/static/codemirror/codemirror.js:1947–1968  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

1945 }
1946
1947 function onDragStart(cm, e) {
1948 if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
1949 if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
1950
1951 var txt = cm.getSelection();
1952 e.dataTransfer.setData("Text", txt);
1953
1954 // Use dummy image instead of default browsers image.
1955 // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
1956 if (e.dataTransfer.setDragImage && !safari) {
1957 var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
1958 img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
1959 if (opera) {
1960 img.width = img.height = 1;
1961 cm.display.wrapper.appendChild(img);
1962 // Force a relayout, or Opera won't use our image for some obscure reason
1963 img._top = img.offsetTop;
1964 }
1965 e.dataTransfer.setDragImage(img, 0, 0);
1966 if (opera) img.parentNode.removeChild(img);
1967 }
1968 }
1969
1970 function setScrollTop(cm, val) {
1971 if (Math.abs(cm.doc.scrollTop - val) < 2) return;

Callers 1

registerEventHandlersFunction · 0.70

Calls 6

e_stopFunction · 0.70
signalDOMEventFunction · 0.70
eventInWidgetFunction · 0.70
eltFunction · 0.70
appendChildMethod · 0.45
removeChildMethod · 0.45

Tested by

no test coverage detected