MCPcopy Create free account
hub / github.com/angular/components / toggleDensity

Method toggleDensity

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

Source from the content-addressed store, hash-verified

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