MCPcopy
hub / github.com/CodeboxIDE/codebox / f

Function f

client/utils/dragdrop.js:183–216  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

181 if (options.start) options.start();
182
183 var f = function(e) {
184 var _drop = that.getDrop();
185
186 dx = oX - e.pageX;
187 dy = oY - e.pageY;
188
189 if (Math.abs(dx) > 20 || Math.abs(dy) > 20) {
190 if (!hasMove) {
191 setCursor(options.cursor);
192 $el.addClass("move");
193 }
194 hasMove = true;
195 }
196
197 ex = poX - dx;
198 ey = poY - dy;
199
200 if (_drop && _drop.options.constrain) {
201 cw = _drop.$el.width();
202 ch = _drop.$el.height();
203 cx = _drop.$el.offset().left;
204 cy = _drop.$el.offset().top;
205
206 if (Math.abs(ey - cy) < 50) ey = cy;
207 if (Math.abs((ey + eh) - (cy+ch)) < 50) ey = cy + ch - eh;
208 if (Math.abs(ex - cx) < 50) ex = cx;
209 if (Math.abs((ex + ew) - (cx+cw)) < 50) ex = cx + cw - ew;
210 }
211
212 $el.css({
213 'left': ex,
214 'top': ey
215 });
216 };
217
218 $document.on(events["move"], f);
219 $document.one(events["stop"], function(e) {

Callers

nothing calls this directly

Calls 1

setCursorFunction · 0.85

Tested by

no test coverage detected