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

Method ui

src/dd-draggable.ts:492–514  ·  view source on GitHub ↗

@internal TODO: set to public as called by DDDroppable!

()

Source from the content-addressed store, hash-verified

490
491 /** @internal TODO: set to public as called by DDDroppable! */
492 public ui(): DDUIData {
493 const containmentEl = this.el.parentElement;
494 const containmentRect = containmentEl.getBoundingClientRect();
495 const offset = this.helper.getBoundingClientRect();
496
497 // RTL: GridStack measures column positions from the right side of the container,
498 // so we report `left` as the distance between the helper's right edge and the
499 // container's right edge (both in viewport-left coordinates via getBoundingClientRect).
500 const leftPos = this.option.rtl
501 ? (containmentRect.right - offset.right) * this.dragTransform.xScale
502 : (offset.left - containmentRect.left) * this.dragTransform.xScale;
503
504 return {
505 position: { //Current CSS position of the helper as { top, left } object
506 top: (offset.top - containmentRect.top) * this.dragTransform.yScale,
507 left: leftPos
508 }
509 /* not used by GridStack for now...
510 helper: [this.helper], //The object arr representing the helper that's being dragged.
511 offset: { top: offset.top, left: offset.left } // Current offset position of the helper as { top, left } object.
512 */
513 };
514 }
515}

Callers 3

_callDragMethod · 0.95
_mouseMoveMethod · 0.95
_uiMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected