研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
blockly >MetricsManager >getMetrics
MetricsManager.getMetrics() 方法
返回一个对象,其中包含为顶级工作区调整滚动条大小所需的所有指标。系统会计算以下属性:坐标系:像素坐标、-left、-up、+right、+down。viewHeight:工作区的可见部分的高度。.viewWidth:工作区的可见部分的宽度。.contentHeight:内容的高度。.contentWidth:内容的宽度。.scrollHeight:滚动区域的高度。.scrollWidth:滚动区域的宽度。.svgHeight:Blockly div(视图 + 工具箱,无论简单还是其他)的高度;.svgWidth:Blockly div(视图 + 工具箱,简单或其他)的宽度;.viewTop:工作区可见部分相对于工作区原点的上边缘。.viewLeft:工作区可见部分相对于工作区原点的左边缘。.contentTop:内容相对于工作区源的上边缘。.contentLeft:相对于工作区原点的内容左边缘。.scrollTop:滚动区域相对于工作区原点的上边缘。.scrollLeft:相对于工作区原点的滚动区域左边缘。.relativeTop:工作区可见部分(相对于 blocklyDiv)的上边缘。.relativeLeft:工作区可见部分的左边缘(相对于 blocklyDiv)。.toolboxWidth:工具箱的宽度(如果有)。否则为零。.toolboxHeight:工具箱的高度(如果存在)。否则为零。.flyoutWidth :浮出控件始终处于打开状态时的宽度。否则为零。.flyoutHeight:如果始终处于打开状态,则展开式窗格的高度。否则为零。.toolboxPosition:顶部、底部、左侧或右侧。使用 TOOLBOX_AT 常量进行比较。
Signature:
getMetrics(): Metrics;
返回:
指标
包含顶级工作区的尺寸和位置指标。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-10-11。
[null,null,["最后更新时间 (UTC):2024-10-11。"],[[["The `getMetrics()` method calculates and returns an object containing size and position data for various elements within a Blockly workspace, including the viewable area, content, scrollbars, toolbox, and flyout."],["This information is essential for correctly sizing and positioning scrollbars and other UI elements to ensure proper display and interaction within the workspace."],["The returned object adheres to the `Metrics` interface and provides properties like `viewHeight`, `contentWidth`, `scrollTop`, `toolboxPosition`, and more for comprehensive workspace metrics."],["Developers can utilize this method to access critical layout information and dynamically adjust the workspace's appearance based on its contents and available space."]]],[]]