blockly > 工具箱

工具箱類別

Toolbox 的類別。建立工具箱的 DOM。

Signature:

export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeyboardAccessible, IStyleable, IToolbox 

擴充: DeleteArea

實作: IAutoHideableIKeyboardAccessibleIStyleableIToolbox

建構函式

建構函式 修飾符 說明
(建構函式)(工作區) 建構 Toolbox 類別的新執行個體

屬性

屬性 修飾符 類型 說明
boundEvents_ protected browserEvents.Data[] 陣列保留資訊,以解除事件處理常式的繫結。用於處理。例如:[[節點, 名稱, Func], [節點, 名稱, 趣味 c]]。
contentMap_ protected { [key: string]: IToolboxItem; }
contents_ protected IToolboxItem[] 工具箱中的項目清單。
contentsDiv_ protected HTMLDivElement | 空值 工具箱內容的 HTML 容器。
height_ protected 號碼 工具箱的高度。
HtmlDiv HTMLDivElement | 空值 工具箱的 HTML 容器。
id 字串 此元件的專屬 ID,可用於向 ComponentManager 註冊。
isVisible_ protected boolean 是否顯示 Toolbox。
previouslySelectedItem_ protected ISelectableToolboxItem | 空值 先前選取的項目。
RTL boolean
selectedItem_ protected ISelectableToolboxItem | 空值 目前選取的項目。
toolboxDef_ protected toolbox.ToolboxInfo
toolboxPosition toolbox.Position
width_ protected 號碼 工具箱的寬度。
workspace_

protected

readonly

WorkspaceSvg 這個工具箱已啟用的工作區。

方法

方法 修飾符 說明
addToolboxItem_(toolboxItem) protected 將項目新增至工具箱。
AttachEvents_(container, contentContainer) protected 將事件監聽器新增至 Toolbox 容器 div。
autoHide(onlyClosePopups) 隱藏元件。在 WorkspaceSvg.hideChaff 中呼叫。
clearSelection() 取消醒目顯示任何先前選取的項目。
createContainer_() protected 建立工具箱的容器 div。
createContentsContainer_() protected 為工具箱中所有的內容建立容器。
createDom_(workspace) protected 建立工具箱的 DOM。
createFlyout_() protected 根據工具箱版面配置建立飛行。
deselectItem_(item) protected 取消選取指定項目、標示為未選取,並更新 Aria 狀態。
dispose() 丟棄這個工具箱。
getClientRect() 根據可視區域的像素單位,傳回拖曳目標區域的邊界矩形。
getFlyout() 取得工具箱延伸。
getHeight() 取得工具箱的高度。
getPreviouslySelectedItem() 取得之前選取的項目。
getSelectedItem() 取得選取的項目。
getToolboxItemById(id) 取得具有指定 ID 的工具箱項目。
getToolboxItems() 取得工具箱中的項目。
getWidth() 取得工具箱的寬度。
getWorkspace() 取得工具箱的工作區。
init() 初始化工具箱
isHorizontal() 取得工具方塊是否為水平。
onClick_(e) protected 處理點擊工具方塊或工具箱項目時的點擊事件。
onDragEnter(_dragElement) 處理有方塊或對話框的遊標進入這個拖曳目標時處理。
onDragExit(_dragElement) 處理含有方塊或泡泡的遊標離開這個拖曳目標時處理。
onDrop(_dragElement) 於此元件捨棄方塊或對話框時處理。這裡不應處理刪除。
onKeyDown_(e) protected 處理工具箱的按下按鍵事件。
onShortcut(_shortcut) 處理指定的鍵盤快速鍵。
position() 根據工具是否為水平工具箱和工作區是否位於 rtl 來決定位置。
refreshSelection() 更新延伸活動的內容,不要關閉。僅限用於回應任一動態類別的變更 (例如變數或程序)。
renderContents_(toolboxDef) protected 將所有工具箱項目新增至工具箱。
selectItem_(舊項目, 新項目) protected 選取指定項目並標示為選取,並更新 Aria 狀態。
selectItemByPosition(position) 依照工具箱項目清單中的位置選取工具箱項目。
setSelectedItem(newItem) 將指定項目設為選取項目。如果該項目無法選取,則無需人工操作。
setVisible(isVisible) 顯示或隱藏工具箱。
shouldDeselectItem_(oldItem, newItem) protected 決定是否要取消選取舊項目。
shouldSelectItem_(oldItem, newItem) protected 決定是否應選取新項目。
updateCursorDeleteStyle_(addStyle) protected 在工具箱上新增或移除遊標的 CSS 樣式,取決於是否要捨棄該區塊或泡泡 (使用內部的 this.wouldDelete_ 屬性)。
updateFlyout_(oldItem, newItem) protected 根據選取的項目決定要隱藏或顯示飛輪。
updateWouldDelete_(wouldDelete) protected 更新 internal shouldDelete_ 狀態。
wouldDelete(element, _couldConnect) 傳回如果把提供的區塊或泡泡捨棄在這個區域,是否會刪除。此方法應檢查元素是否可刪除,而且一律會在 onDragEnter/onDragOver/onDragExit 之前呼叫。