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

Method winPos

core/render.go:441–448  ·  view source on GitHub ↗

winPos returns the RenderWindow based position within the bounding box of the widget, where the x, y coordinates are the proportion across the bounding box to use: 0 = left / top, 1 = right / bottom

(x, y float32)

Source from the content-addressed store, hash-verified

439// are the proportion across the bounding box to use:
440// 0 = left / top, 1 = right / bottom
441func (wb *WidgetBase) winPos(x, y float32) image.Point {
442 bb := wb.winBBox()
443 sz := bb.Size()
444 var pt image.Point
445 pt.X = bb.Min.X + int(math32.Round(float32(sz.X)*x))
446 pt.Y = bb.Min.Y + int(math32.Round(float32(sz.Y)*y))
447 return pt
448}
449
450// Profiling and Benchmarking, controlled by settings app bar:
451

Callers 1

ContextMenuPosMethod · 0.95

Calls 3

winBBoxMethod · 0.95
RoundFunction · 0.92
SizeMethod · 0.65

Tested by

no test coverage detected