移動選項
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以使用三種不同方法移動 Blockly 的主要工作區:捲軸、滑鼠或滑鼠滾輪。
移動設定是由 Blockly 設定選項中的物件定義。範例如下:
var workspace = Blockly.inject('blocklyDiv',
{move:{
scrollbars: {
horizontal: true,
vertical: true
},
drag: true,
wheel: false}
});
判斷工作區是否有垂直或水平捲軸。這個函式會採用物件,其中的 horizontal
屬性會決定是否啟用水平捲動,而 vertical
屬性則會決定是否啟用垂直捲動。如果傳遞布林值,則相當於傳遞物件,且 horizontal
和 vertical
屬性都設為該值。如果工作區有類別,預設值為 true
(啟用水平和垂直捲動)。
拖曳
決定是否能以滑鼠拖曳工作區。一律 false
if
scrollbars
is false
(至少在選項剖析中)。如果 scrollbars
為 true
,則預設值為 true
。
wheel
決定是否能使用滑鼠滾輪捲動工作區。一律 false
如果 scrollbars
是 false
(至少在選項剖析中)。預設為 false
。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-16 (世界標準時間)。
[null,null,["上次更新時間: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,[]]