移动选项
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Blockly 的主工作区可以使用三种不同的方法移动:滚动条、鼠标或鼠标滚轮。
移动设置由 Blockly 的配置选项中的一个对象定义。示例如下:
var workspace = Blockly.inject('blocklyDiv',
{move:{
scrollbars: {
horizontal: true,
vertical: true
},
drag: true,
wheel: false}
});
确定工作区是否具有垂直或水平滚动条。接受一个对象,其中的 horizontal
属性用于确定是否启用水平滚动,vertical
属性用于确定是否启用垂直滚动。
如果传递的是布尔值,则相当于传递一个对象,其中 horizontal
和 vertical
属性均设置为该值。如果工作区包含类别,则默认值为 true
(同时启用水平滚动和垂直滚动)。
拖动
确定工作区是否可使用鼠标拖动。如果 scrollbars
为 false
,则始终为 false
(至少在选项解析中)。如果 scrollbars
为 true
,则默认为 true
。
wheel
确定工作区是否可以通过鼠标滚轮滚动。如果 scrollbars
为 false
,则始终为 false
(至少在选项解析中)。默认设置为 false
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-09-16。
[null,null,["最后更新时间 (UTC):2025-09-16。"],[],["Blockly's workspace movement is configured via the `move` object within its settings. This configuration allows defining the behavior of scrollbars, mouse dragging, and mouse wheel scrolling. `scrollbars` enables horizontal and/or vertical scrolling. `drag` enables mouse dragging, dependent on scrollbars being enabled. `wheel` enables mouse wheel scrolling, also dependent on scrollbars. Default settings include both scrollbars enabled and mouse dragging enabled, but mouse wheel disabled. If scrollbars are false then drag and wheel will be false as well.\n"],null,[]]