MCPcopy Index your code
hub / github.com/microsoft/SandDance / viewSizeLayout

Function viewSizeLayout

docs/app/js/sanddance-app.js:120932–120964  ·  view source on GitHub ↗
(view, group, viewBounds, _)

Source from the content-addressed store, hash-verified

120930 viewSizeLayout(view, group, viewBounds, _);
120931}
120932function viewSizeLayout(view, group, viewBounds, _) {
120933 const auto = _.autosize || {}, type = auto.type;
120934 if (view._autosize < 1 || !type) return;
120935 let viewWidth = view._width, viewHeight = view._height, width = Math.max(0, group.width || 0), left = Math.max(0, Math.ceil(-viewBounds.x1)), height = Math.max(0, group.height || 0), top = Math.max(0, Math.ceil(-viewBounds.y1));
120936 const right = Math.max(0, Math.ceil(viewBounds.x2 - width)), bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));
120937 if (auto.contains === Padding) {
120938 const padding = view.padding();
120939 viewWidth -= padding.left + padding.right;
120940 viewHeight -= padding.top + padding.bottom;
120941 }
120942 if (type === None) {
120943 left = 0;
120944 top = 0;
120945 width = viewWidth;
120946 height = viewHeight;
120947 } else if (type === Fit) {
120948 width = Math.max(0, viewWidth - left - right);
120949 height = Math.max(0, viewHeight - top - bottom);
120950 } else if (type === FitX) {
120951 width = Math.max(0, viewWidth - left - right);
120952 viewHeight = height + top + bottom;
120953 } else if (type === FitY) {
120954 viewWidth = width + left + right;
120955 height = Math.max(0, viewHeight - top - bottom);
120956 } else if (type === Pad) {
120957 viewWidth = width + left + right;
120958 viewHeight = height + top + bottom;
120959 }
120960 view._resizeView(viewWidth, viewHeight, width, height, [
120961 left,
120962 top
120963 ], auto.resize);
120964}
120965
120966},{"vega-dataflow":"4kvYg","vega-scenegraph":"gIB0Z","vega-util":"dPFAY","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"gIB0Z":[function(require,module,exports) {
120967var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers 1

layoutGroupFunction · 0.70

Calls 1

maxMethod · 0.45

Tested by

no test coverage detected