研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
blockly >网格
Grid 类
用于工作区网格的类。
Signature:
export declare class Grid
构造函数
方法
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):2024-08-21。"],[[["The `Grid` class manages the visual grid of a Blockly workspace, controlling its appearance and block snapping behavior."],["It provides methods to adjust grid spacing, line length, and alignment of elements to the grid."],["Blocks can be programmatically snapped to the grid, ensuring consistent placement and organization."],["The grid's visual characteristics and snapping behavior can be customized using its methods."]]],["The `Grid` class manages a workspace's grid. Key actions include constructing a grid, aligning coordinates to the grid (`alignXY`), and managing grid properties. Methods allow retrieving (`getLength`, `getSpacing`) and setting (`setLength`, `setSpacing`) the grid line length and spacing. `setSnapToGrid` enables grid snapping for blocks, which is activated upon the next drag-and-drop. `shouldSnap` checks if snapping is active.\n"]]