MCPcopy Index your code
hub / github.com/UI5/webcomponents / _resizeWithEvent

Method _resizeWithEvent

packages/main/src/Dialog.ts:526–561  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

524 }
525
526 _resizeWithEvent(e: KeyboardEvent) {
527 this._draggedOrResized = true;
528 this.addEventListener("ui5-before-close", this._revertSize, { once: true });
529
530 const { top, left } = this.getBoundingClientRect(),
531 style = window.getComputedStyle(this),
532 minWidth = Number.parseFloat(style.minWidth),
533 maxWidth = window.innerWidth - left,
534 maxHeight = window.innerHeight - top;
535
536 let width = Number.parseFloat(style.width),
537 height = Number.parseFloat(style.height);
538
539 switch (true) {
540 case isUpShift(e):
541 height -= STEP_SIZE;
542 break;
543 case isDownShift(e):
544 height += STEP_SIZE;
545 break;
546 case isLeftShift(e):
547 width -= STEP_SIZE;
548 break;
549 case isRightShift(e):
550 width += STEP_SIZE;
551 break;
552 }
553
554 width = clamp(width, minWidth, maxWidth);
555 height = clamp(height, this._minHeight, maxHeight);
556
557 Object.assign(this.style, {
558 width: `${width}px`,
559 height: `${height}px`,
560 });
561 }
562
563 _attachMouseDragHandlers() {
564 window.addEventListener("mousemove", this._dragMouseMoveHandler);

Callers 1

Calls 5

isUpShiftFunction · 0.85
isDownShiftFunction · 0.85
isLeftShiftFunction · 0.85
isRightShiftFunction · 0.85
clampFunction · 0.85

Tested by

no test coverage detected