使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >blockRendering >RenderInfo >RenderInfogetElemCenterline_
blockRendering.RenderInfo.getElemCenterline_() 方法
计算呈现行中某个元素的中心线。此基本实现将中心线垂直置于行的中间,没有特殊情况。您可能需要额外的逻辑来处理(至少)顶部和底部行。
Signature:
protected getElemCenterline_(row: Row, elem: Measurable): number;
参数
参数 |
类型 |
说明 |
行 |
Row |
包含相应元素的行。 |
Elem |
可衡量 |
要放置的元素。 |
返回:
number
指定元素所需的中心线,以相对于块左上角的偏移量。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-25。"],[],["The `getElemCenterline_()` method calculates the vertical centerline of an element within a rendered row. It positions the centerline at the row's vertical midpoint. The method takes a `Row` and a `Measurable` element as input. It returns a number representing the element's centerline offset from the block's top-left corner. Custom implementations are often needed to adjust positioning for specific rows.\n"]]