跳轉到內容

Rebol 程式設計/span?

來自華夏公益教科書
SPAN? pane /part count 

返回所有面的 [最小值 最大值] 範圍的塊

SPAN? 是一個函式值。

  • 窗格 -- (型別:塊)
  • /part
    • 計數 -- 限制面的數量 (型別:整數)

原始碼

[編輯 | 編輯原始碼]
span?: func [
    "Returns a block of [min max] bounds for all faces" 
    pane [block!] 
    /part count [integer!] "Limit the number of faces" 
    /local origin margin
][
    origin: 100000x100000 
    margin: 0x0 
    foreach item pane [
        if object? item [
            if all [count negative? count: count - 1] [break] 
            origin: min origin item/offset 
            margin: max margin item/offset + item/size
        ]
    ] 
    reduce [origin margin]
]
華夏公益教科書