MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / _setupHelperStyle

Method _setupHelperStyle

src/dd-draggable.ts:332–351  ·  view source on GitHub ↗

@internal set the fix position of the dragged item

(e: DragEvent)

Source from the content-addressed store, hash-verified

330
331 /** @internal set the fix position of the dragged item */
332 protected _setupHelperStyle(e: DragEvent): DDDraggable {
333 this.helper.classList.add('ui-draggable-dragging');
334 this.el.gridstackNode?.grid?.el.classList.add('grid-stack-dragging');
335 // TODO: set all at once with style.cssText += ... ? https://stackoverflow.com/questions/3968593
336 const style = this.helper.style;
337 style.pointerEvents = 'none'; // needed for over items to get enter/leave
338 // style.cursor = 'move'; // TODO: can't set with pointerEvents=none ! (no longer in CSS either as no-op)
339 style.width = this.dragOffset.width + 'px';
340 style.height = this.dragOffset.height + 'px';
341 style.willChange = 'left, right, top';
342 style.position = 'fixed'; // let us drag between grids by not clipping as parent .grid-stack is position: 'relative'
343 this._dragFollow(e); // now position it
344 style.transition = 'none'; // show up instantly
345 setTimeout(() => {
346 if (this.helper) {
347 style.transition = null; // recover animation
348 }
349 }, 0);
350 return this;
351 }
352
353 /** @internal restore back the original style before dragging */
354 protected _removeHelperStyle(): DDDraggable {

Callers 1

_mouseMoveMethod · 0.95

Calls 2

_dragFollowMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected