常量提供程序
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
ConstantProvider
是所有其他渲染程序组件以及 Blockly 的其他部分(例如内置字段)使用的神奇数字、形状和字符串的集合。
所有常量值都假定为常量!在运行时更改值会导致渲染 bug。
连接形状
常量提供程序包含不同连接的标准形状的定义。Notch
用于定义下一个和上一个连接的形状。PuzzleTab
定义了输入和输出连接的形状。(这些名称基于默认渲染程序提供的形状。)
基于检查的连接形状
常量提供程序还可以根据其连接检查动态定义连接的形状。这是使用 shapeFor
方法完成的。
其他各种路径
常量提供程序还定义了代码块其他不同部分的路径,例如收起的块的锯齿状边缘。
其他各种值
最后,常量提供程序还为不同元素之间的内边距或行最小高度等内容定义各种值。
如未另行说明,那么本页面中的内容已根据知识共享署名 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 `ConstantProvider` stores essential rendering data for Blockly, including connection shapes, paths, and values. It defines standard connection shapes like `Notch` for next/previous connections and `PuzzleTab` for input/output. The `shapeFor` method allows dynamic shape definition based on connection checks. Additionally, it defines paths for block components, like jagged edges, and values for padding and minimum row heights, ensuring consistent rendering. Changing these values at runtime will cause rendering issues.\n"]]