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

Function viewSizeLayout

docs/tests/v2/es6/js/sanddance.js:104716–104755  ·  view source on GitHub ↗
(view, group, viewBounds, _)

Source from the content-addressed store, hash-verified

104714}
104715
104716function viewSizeLayout(view, group, viewBounds, _) {
104717 var auto = _.autosize || {},
104718 type = auto.type,
104719 viewWidth = view._width,
104720 viewHeight = view._height,
104721 padding = view.padding();
104722 if (view._autosize < 1 || !type) return;
104723 var width = Math.max(0, group.width || 0),
104724 left = Math.max(0, Math.ceil(-viewBounds.x1)),
104725 right = Math.max(0, Math.ceil(viewBounds.x2 - width)),
104726 height = Math.max(0, group.height || 0),
104727 top = Math.max(0, Math.ceil(-viewBounds.y1)),
104728 bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));
104729
104730 if (auto.contains === _constants.Padding) {
104731 viewWidth -= padding.left + padding.right;
104732 viewHeight -= padding.top + padding.bottom;
104733 }
104734
104735 if (type === _constants.None) {
104736 left = 0;
104737 top = 0;
104738 width = viewWidth;
104739 height = viewHeight;
104740 } else if (type === _constants.Fit) {
104741 width = Math.max(0, viewWidth - left - right);
104742 height = Math.max(0, viewHeight - top - bottom);
104743 } else if (type === _constants.FitX) {
104744 width = Math.max(0, viewWidth - left - right);
104745 viewHeight = height + top + bottom;
104746 } else if (type === _constants.FitY) {
104747 viewWidth = width + left + right;
104748 height = Math.max(0, viewHeight - top - bottom);
104749 } else if (type === _constants.Pad) {
104750 viewWidth = width + left + right;
104751 viewHeight = height + top + bottom;
104752 }
104753
104754 view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize);
104755}
104756},{"./constants":"OeAt","./layout/axis":"CoCs","./layout/grid":"PNHc","./layout/legend":"rbUP","./layout/title":"Mnvo","vega-dataflow":"luN0","vega-scenegraph":"AgKg","vega-util":"d61Z"}],"VlWy":[function(require,module,exports) {
104757"use strict";
104758

Callers 1

layoutGroupFunction · 0.70

Calls 1

maxMethod · 0.45

Tested by

no test coverage detected