MCPcopy
hub / github.com/g3n/engine / insertItems

Method insertItems

gui/tree.go:422–446  ·  view source on GitHub ↗

insertItems inserts this node items in the tree list at the specified position

(pos int)

Source from the content-addressed store, hash-verified

420// insertItems inserts this node items in the tree list
421// at the specified position
422func (n *TreeNode) insertItems(pos int) int {
423
424 if !n.expanded {
425 return pos
426 }
427 level := n.level() + 1
428 var padLeft float32 = n.tree.styles.Padlevel * float32(level)
429 for _, ipanel := range n.items {
430 // Insert node and its children
431 node, ok := ipanel.(*TreeNode)
432 if ok {
433 node.update()
434 node.litem = n.tree.List.InsertAt(pos, ipanel)
435 n.tree.List.SetItemPadLeftAt(pos, padLeft)
436 pos++
437 pos = node.insertItems(pos)
438 continue
439 }
440 // Insert item
441 n.tree.List.InsertAt(pos, ipanel)
442 n.tree.List.SetItemPadLeftAt(pos, padLeft)
443 pos++
444 }
445 return pos
446}
447
448// updateItems updates this node items, removing or inserting them into the tree scroller
449func (n *TreeNode) updateItems() {

Callers 2

insertMethod · 0.95
updateItemsMethod · 0.95

Calls 4

levelMethod · 0.95
SetItemPadLeftAtMethod · 0.80
updateMethod · 0.45
InsertAtMethod · 0.45

Tested by

no test coverage detected