MCPcopy Create free account
hub / github.com/nodejs/node / rangesUpdate

Method rangesUpdate

deps/v8/tools/turbolizer/src/resizer.ts:75–102  ·  view source on GitHub ↗
(isRangesExpanded: boolean)

Source from the content-addressed store, hash-verified

73 }
74
75 public rangesUpdate(isRangesExpanded: boolean): void {
76 storageSetItem("expandedState-ranges", isRangesExpanded);
77 this.rangesShowHide.dataset.expanded = isRangesExpanded ? "1" : "0";
78 const landscapeMode = this.resizer.isRangesInLandscapeMode();
79 this.rangesExpandVert.classList.toggle("invisible", !landscapeMode || isRangesExpanded);
80 this.rangesCollapseVert.classList.toggle("invisible", !landscapeMode || !isRangesExpanded);
81 this.rangesExpandHor.classList.toggle("invisible", landscapeMode || isRangesExpanded);
82 this.rangesCollapseHor.classList.toggle("invisible", landscapeMode || !isRangesExpanded);
83 let left: number;
84 if (landscapeMode) {
85 left = this.resizer.sepLeft + this.resizer.RESIZER_SIZE;
86 } else {
87 left = isRangesExpanded
88 ? this.resizer.sepRangesX + this.resizer.RESIZER_SIZE
89 : (this.resizer.sepRangesX - this.rangesShowHide.clientWidth
90 - (2 * this.resizer.RESIZER_SIZE));
91 }
92 const marginLeft = parseInt(window.getComputedStyle(this.rangesShowHide, null)
93 .getPropertyValue("margin-left").slice(0, -2), 10);
94 const marginRight = parseInt(window.getComputedStyle(this.rangesShowHide, null)
95 .getPropertyValue("margin-right").slice(0, -2), 10);
96 const width = this.rangesShowHide.clientWidth + marginLeft + marginRight;
97 // The left value is bounded on both sides by another show/hide button of the same width. The
98 // max value must also account for its own width. marginRight is subtracted from both sides to
99 // reduce the separation between buttons.
100 const maxLeft = document.body.getBoundingClientRect().width - (2 * width) + marginRight;
101 this.rangesShowHide.style.left = `${Math.max(width - marginRight, Math.min(left, maxLeft))}px`;
102 }
103
104 public setRangesExpanded(isRangesExpanded: boolean): void {
105 this.rangesUpdate(isRangesExpanded);

Callers 2

setRangesExpandedMethod · 0.95
updateRangesPaneMethod · 0.80

Calls 5

storageSetItemFunction · 0.90
sliceMethod · 0.65
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected