MCPcopy Index your code
hub / github.com/angular/components / toggleDensity

Method toggleDensity

src/dev-app/dev-app/dev-app-layout.ts:195–208  ·  view source on GitHub ↗
(index?: number, tooltipInstance?: MatTooltip)

Source from the content-addressed store, hash-verified

193 }
194
195 toggleDensity(index?: number, tooltipInstance?: MatTooltip) {
196 if (index == null) {
197 index = (this._densityScales.indexOf(this.state.density) + 1) % this._densityScales.length;
198 }
199
200 this.state.density = this._densityScales[index];
201 setAppState(this.state);
202
203 // Keep the tooltip open so we can see what the density was changed to. Ideally we'd
204 // always show the density in a badge, but the M2 badge is too large for the toolbar.
205 if (tooltipInstance) {
206 requestAnimationFrame(() => tooltipInstance.show(0));
207 }
208 }
209
210 toggleRippleDisabled(value = !this.state.rippleDisabled) {
211 this._rippleOptions.disabled = this.state.rippleDisabled = value;

Callers 1

constructorMethod · 0.95

Calls 2

setAppStateFunction · 0.90
showMethod · 0.45

Tested by

no test coverage detected