UNPKG

1.09 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3/**
4 * @ignore
5 * G2 默认提供的 layout 函数
6 * 内置布局函数处理的逻辑:
7 *
8 * 1. 如果 padding = 'auto',那么自动根据组件的 direction 来计算 padding 数组
9 * 2. 根据 padding 和 direction 去分配对应方向的 padding 数值
10 * 3. 移动组件位置
11 *
12 * 前面 1,2 步骤在 view 中已经做掉了。对于组件响应式布局,可以尝试使用约束布局的方式去求解位置信息。
13 * @param view
14 */
15function defaultLayout(view) {
16 var axis = view.getController('axis');
17 var legend = view.getController('legend');
18 var annotation = view.getController('annotation');
19 var slider = view.getController('slider');
20 var scrollbar = view.getController('scrollbar');
21 // 根据最新的 coordinate 重新布局组件
22 [axis, slider, scrollbar, legend, annotation].forEach(function (controller) {
23 if (controller) {
24 controller.layout();
25 }
26 });
27}
28exports.default = defaultLayout;
29//# sourceMappingURL=index.js.map
\No newline at end of file