响应微件
此示例演示如何使用 SceneView 上的 widthBreakpoint 和 heightBreakpoint 属性来响应性地控制视图的默认微件的可见性。
R调整窗口大小以查看默认微件消失并重新出现在视图中。
您可以在视图的 widthBreakpoint
或 heightBreakpoint
属性的监视处理程序中控制视图 UI 组件中的微件可见性。
此示例演示如何使用 SceneView 上的 widthBreakpoint 和 heightBreakpoint 属性来响应性地控制视图的默认微件的可见性。
R调整窗口大小以查看默认微件消失并重新出现在视图中。
您可以在视图的 widthBreakpoint
或 heightBreakpoint
属性的监视处理程序中控制视图 UI 组件中的微件可见性。
1
2
3
4
5
6
7
8
9
view.watch("widthBreakpoint", (newVal) => {
if (newVal === "xsmall") {
// clear the view's default UI components if
// app is used on a small device
view.ui.components = ["attribution"];
} else if (view.ui.components.length === 1) {
view.ui.components = ["attribution", "navigation-toggle", "compass", "zoom"];
}
});
Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.