MCPcopy Create free account
hub / github.com/material-shell/material-shell / updateBasis

Method updateBasis

src/layout/msWorkspace/portion.ts:406–436  ·  view source on GitHub ↗
(basisRatio: number)

Source from the content-addressed store, hash-verified

404 }
405
406 updateBasis(basisRatio: number) {
407 if (basisRatio < 0) {
408 basisRatio = 0;
409 }
410
411 const basisSum = this.firstPortion.basis + this.secondPortion.basis;
412 this.firstPortion.basis *= basisRatio;
413
414 if (this.firstPortion.basis / basisSum < MIN_BASIS_RATIO) {
415 this.firstPortion.basis = MIN_BASIS_RATIO * basisSum;
416 } else if (this.firstPortion.basis / basisSum > 1 - MIN_BASIS_RATIO) {
417 this.firstPortion.basis = (1 - MIN_BASIS_RATIO) * basisSum;
418 } else if (
419 this.firstPortion.basis / basisSum > 0.24 &&
420 this.firstPortion.basis / basisSum < 0.26
421 ) {
422 this.firstPortion.basis = basisSum * 0.25;
423 } else if (
424 this.firstPortion.basis / basisSum > 0.49 &&
425 this.firstPortion.basis / basisSum < 0.51
426 ) {
427 this.firstPortion.basis = basisSum * 0.5;
428 } else if (
429 this.firstPortion.basis / basisSum > 0.74 &&
430 this.firstPortion.basis / basisSum < 0.76
431 ) {
432 this.firstPortion.basis = basisSum * 0.75;
433 }
434
435 this.secondPortion.basis = basisSum - this.firstPortion.basis;
436 }
437}

Callers 2

updateResizeMethod · 0.80
resizeTileableMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected