switch list layouts
This commit is contained in:
parent
358cbda628
commit
575ed7f5aa
1 changed files with 12 additions and 2 deletions
|
|
@ -43,12 +43,20 @@
|
|||
(inspector.register :list 15 #(and (= (type $1) :table) (. $1 1))
|
||||
(fn [form state value]
|
||||
(let [h (horiz-wrapper form)
|
||||
orig-w form.w
|
||||
next-form (fn [i form]
|
||||
(when (= state.layout nil)
|
||||
(set state.layout (if (or (= orig-w nil) (< (/ form.w orig-w) 0.15)) :horiz :vert)))
|
||||
(if (= i 1) (h form)
|
||||
(case state.layout
|
||||
:horiz (h form)
|
||||
:vert (under form))))
|
||||
g (group-wrapper form)]
|
||||
(when (= nil state.keys) (set state.keys {}))
|
||||
(g label (h form) "[")
|
||||
(each [i item (ipairs value)]
|
||||
(when (= nil (. state.keys i)) (tset state.keys i {:children {}}))
|
||||
(g inspector.draw (h form) (. state.keys i :children) item))
|
||||
(g inspector.draw (next-form i form) (. state.keys i :children) item))
|
||||
(g label (h form) "]")
|
||||
(g)))
|
||||
[(fn [form state value]
|
||||
|
|
@ -74,7 +82,9 @@
|
|||
(selection true) (do (each [_ child-state (ipairs state.keys)] (tset child-state.children :inspector selection))
|
||||
true))]
|
||||
(when (and (active? form.view tag) (not was-active))
|
||||
(set state.item-inspectors (rebuild-list value))))))])
|
||||
(set state.item-inspectors (rebuild-list value))))))
|
||||
(fn [form state value] (when (and (= state.layout :horiz) (textbutton form :Vert)) (set state.layout :vert)))
|
||||
(fn [form state value] (when (and (= state.layout :vert) (textbutton form :Horiz)) (set state.layout :horiz)))])
|
||||
|
||||
(inspector.register :thunk 10
|
||||
#(and (= (type $1) :function)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue