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

Method _applyChange

src/dd-resizable.ts:324–350  ·  view source on GitHub ↗

@internal

()

Source from the content-addressed store, hash-verified

322
323 /** @internal */
324 protected _applyChange(): DDResizable {
325 let containmentRect = { left: 0, right: 0, top: 0, width: 0, height: 0 };
326 if (this.el.style.position === 'absolute') {
327 const containmentEl = this.el.parentElement;
328 const { left, right, top } = containmentEl.getBoundingClientRect();
329 containmentRect = { left, right, top, width: 0, height: 0 };
330 }
331 if (!this.temporalRect) return this;
332 Object.entries(this.temporalRect).forEach(([key, value]) => {
333 if (this.option.rtl ? key === 'left' : key === 'right')
334 return;
335
336 const scaleReciprocal = key === 'width' || key === 'left' || key === 'right'
337 ? this.rectScale.x
338 : key === 'height' || key === 'top'
339 ? this.rectScale.y
340 : 1;
341 let finalValue: string;
342 if (key === 'right') {
343 finalValue = (containmentRect.right - value) * this.rectScale.x + 'px';
344 } else {
345 finalValue = (value - containmentRect[key]) * scaleReciprocal + 'px';
346 }
347 this.el.style[key] = finalValue;
348 });
349 return this;
350 }
351
352 /** @internal */
353 protected _removeHandlers(): DDResizable {

Callers 2

_resizeStartMethod · 0.95
_resizingMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected