MCPcopy Create free account
hub / github.com/microsoft/SandDance / _updateContainerDimension

Function _updateContainerDimension

docs/app/js/sanddance-app.js:42088–42107  ·  view source on GitHub ↗

* Handles an update to the container width/height. * Should only be called when we knew the previous container width/height. * @param newDimension - The new width/height of the container. * @param fullDimensionData - The initial data passed in as a prop to resizeGroup. * @param r

(newDimension, fullDimensionData, renderedData, onGrowData)

Source from the content-addressed store, hash-verified

42086 * @param renderedData - The data that was rendered prior to the container size changing.
42087 * @param onGrowData - Set to true if the Resize group has an onGrowData function.
42088 */ function _updateContainerDimension(newDimension, fullDimensionData, renderedData, onGrowData) {
42089 var nextState;
42090 if (newDimension > _containerDimension) {
42091 if (onGrowData) nextState = {
42092 resizeDirection: "grow",
42093 dataToMeasure: onGrowData(renderedData)
42094 };
42095 else nextState = {
42096 resizeDirection: "shrink",
42097 dataToMeasure: fullDimensionData
42098 };
42099 } else nextState = {
42100 resizeDirection: "shrink",
42101 dataToMeasure: renderedData
42102 };
42103 _containerDimension = newDimension;
42104 return (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), {
42105 measureContainer: false
42106 });
42107 }
42108 function getNextState(props, currentState, getElementToMeasureDimension, newContainerDimension) {
42109 // If there is no new container width/height or data to measure, there is no need for a new state update
42110 if (newContainerDimension === undefined && currentState.dataToMeasure === undefined) return undefined;

Callers 1

getNextStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected