blockly > Flyout

Flyout 類別

下拉式選單的類別。

Signature:

export declare abstract class Flyout extends DeleteArea implements IAutoHideable, IFlyout, IFocusableNode 

擴充: DeleteArea

實作項目: IAutoHideableIFlyoutIFocusableNode

建構函式

建構函式 修飾符 說明
(建構函式)(workspaceOptions) 建構 Flyout 類別的新例項

屬性

屬性 修飾符 類型 說明
autoClose 布林值 建立區塊時,飛出視窗會自動關閉嗎?
內容 protected FlyoutItem[] 下拉式選單元素清單。
CORNER_RADIUS readonly 數字 飛出視窗背景的圓角半徑。
dragAngleRange_ protected 數字 從飛出視窗拖曳的角度範圍,視為「朝向工作區拖曳」。如果拖曳方向與彈出視窗邊緣的正交線之間的角度在這個範圍內,系統就會視為「朝向工作區拖曳」。
GAP_X readonly 數字
GAP_Y readonly 數字
height_ protected 數字 飛出式選單的高度。
膨風者 protected Map<string, IFlyoutInflater> 從飛出視窗內容類型對應至負責建立內容類型具體例項的對應擴充器類別。
MARGIN readonly 數字
RTL 布林值
SCROLLBAR_MARGIN readonly 數字 捲軸與下拉式選單背景邊緣之間的上下邊框間距。
svgBackground_ protected SVGPathElement | null 飛出視窗背景周圍的路徑,會填入背景顏色。
svgGroup_ protected SVGGElement | null 按鈕或標籤的根 SVG 群組。
tabWidth_

protected

readonly

數字
toolboxPosition_ protected 數字
width_ protected 數字 飛出式選單的寬度。
workspace_ protected WorkspaceSvg

方法

方法 修飾符 說明
autoHide(onlyClosePopups) 如果是自動關閉的飛出視窗,系統會自動隱藏。
canBeFocused() 請參閱 IFocusableNode.canBeFocused。
createDom(tagName) 建立下拉式選單的 DOM。只需要呼叫一次。飛出視窗可以是獨立的 SVG 元素,也可以是巢狀內嵌在獨立 SVG 元素中的 g 元素。
dispose() 處置這個飛出視窗。從所有 DOM 元素取消連結,避免記憶體流失。
getContents() 取得目前快速鍵的元素清單。
getFlyoutScale() 取得飛出視窗的比例 (縮放等級)。根據預設,這會與目標工作區規模相符,但可以覆寫。
getFocusableElement() 請參閱 IFocusableNode.getFocusableElement。
getFocusableTree() 請參閱 IFocusableNode.getFocusableTree。
getHeight() 取得飛出視窗的高度。
getInflaterForType(type) protected 傳回負責建構指定類型項目的擴充器。
getNestedTrees() 請參閱 IFocusableNode.getNestedTrees。
getRestoredFocusableNode(_previousNode) 請參閱 IFocusableNode.getRestoredFocusableNode。
getRootFocusableNode() 請參閱 IFocusableNode.getRootFocusableNode。
getTargetWorkspace() 在飛出式視窗中找到目標工作區。
getWidth() 取得飛出視窗的寬度。
getWorkspace() 在彈出式視窗中取得工作區。
getX() abstract 計算下拉式選單位置的 x 座標。
getY() abstract 計算下拉式選單位置的 y 座標。
hide() 隱藏並清空飛出視窗。
init(targetWorkspace) 初始化飛出視窗。
isDragTowardWorkspace(currentDragDeltaXY) abstract 根據飛出視窗的位置和方向,判斷拖曳增量是否朝向工作區。這項屬性會用於 determineDragIntention_,判斷是否應建立新區塊,或是否應捲動彈出視窗。
isVisible() 飛出視窗是否顯示?
layout_(contents)

protected

abstract

在彈出式視窗中配置元素。
lookUpFocusableNode(_id) 請參閱 IFocusableNode.lookUpFocusableNode。
normalizeSeparators(contents) protected

更新並傳回提供的飛出視窗內容清單,視需要扁平化分隔符。

如果連續出現多個分隔符號,系統會優先採用最後一個分隔符號的值,並移除群組中較早出現的分隔符號。

onNodeBlur() 請參閱 IFocusableNode.onNodeBlur。
onNodeFocus() 請參閱 IFocusableNode.onNodeFocus。
onTreeBlur(_nextTree) 請參閱 IFocusableNode.onTreeBlur。
onTreeFocus(_node, _previousTree) 請參閱 IFocusableTree.onTreeFocus。
position() abstract 放置飛出視窗。
positionAt_(width, height, x, y) protected 根據 position() 中計算的座標更新檢視區塊。
reflow() 重排飛出視窗內容。
reflowInternal_()

protected

abstract

計算飛出式視窗的界線。從右到左:將元素靠右對齊。
scrollToStart() abstract 將飛出視窗捲動至內容開頭。
serializeBlock(block) protected 將區塊序列化為 JSON。
setAutoClose(autoClose) 設定是否要在拖曳積木、點選工作區等情況下,自動關閉這個彈出式視窗。
setContainerVisible(visible) 設定是否顯示這個飛出視窗的容器。
setContents(contents) 儲存飛出視窗中的元素清單。
setMetrics_(xyRatio)

protected

abstract

設定飛出視窗的轉譯,使其與捲軸相符。
setVisible(visible) 設定飛出視窗是否顯示。值為 true 不一定表示會顯示飛出視窗。容器遭到隱藏,因此該項目也一併隱藏。
show(flyoutDef) 顯示並填入飛出視窗。
wheel_(e)

protected

abstract

捲動飛出視窗。