MCPcopy Create free account
hub / github.com/cogentcore/core / Split

Method Split

core/splits.go:288–318  ·  view source on GitHub ↗

Split returns the split proportion for given child index

(idx int)

Source from the content-addressed store, hash-verified

286
287// Split returns the split proportion for given child index
288func (sl *Splits) Split(idx int) float32 {
289 ci := 0
290 for i, t := range sl.Tiles {
291 tn := tileNumElements[t]
292 if idx < ci || idx >= ci+tn {
293 ci += tn
294 continue
295 }
296 ri := idx - ci
297 switch t {
298 case TileSpan:
299 return sl.TileSplits[i]
300 case TileSplit:
301 return sl.SubSplits[i][ri]
302 case TileFirstLong:
303 if ri == 0 {
304 return sl.SubSplits[i][0]
305 } else {
306 return sl.SubSplits[i][1+ri]
307 }
308 case TileSecondLong:
309 if ri == 2 {
310 return sl.SubSplits[i][1]
311 } else {
312 return sl.SubSplits[i][2+ri]
313 }
314 }
315 ci += tn
316 }
317 return 0
318}
319
320// ChildIsCollapsed returns true if the split proportion
321// for given child index is 0. Also checks the overall tile

Callers 15

SplitsMethod · 0.95
ChildIsCollapsedMethod · 0.95
FindFileMethod · 0.80
UpdatePathMethod · 0.80
watchUpdateMethod · 0.80
newFileMethod · 0.80
newFolderMethod · 0.80
dirsToMethod · 0.80
blameDialogFunction · 0.80
SearchFunction · 0.80
pasteCheckExistingMethod · 0.80
FontsAvailFromFSMethod · 0.80

Calls

no outgoing calls

Tested by 2

TestTableHeadersFunction · 0.64
printrecurseFunction · 0.64