本文整理匯總了Golang中github.com/antha-lang/antha/internal/github.com/jroimartin/gocui.View.Origin方法的典型用法代碼示例。如果您正苦於以下問題:Golang View.Origin方法的具體用法?Golang View.Origin怎麽用?Golang View.Origin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/antha-lang/antha/internal/github.com/jroimartin/gocui.View
的用法示例。
在下文中一共展示了View.Origin方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: cursorDown
//cursorDown moves the cursor down one position. When reaching the bottom, windows the text
func (c *CUI) cursorDown(g *gocui.Gui, v *gocui.View) error {
if v != nil {
cx, cy := v.Cursor()
if err := v.SetCursor(cx, cy+1); err != nil {
ox, oy := v.Origin()
if err := v.SetOrigin(ox, oy+1); err != nil {
return err
}
}
}
return nil
}
示例2: cursorUp
//cursorUp moves the cursor up one position. When reaching the top, windows the text
func (c *CUI) cursorUp(g *gocui.Gui, v *gocui.View) error {
if v != nil {
ox, oy := v.Origin()
cx, cy := v.Cursor()
if err := v.SetCursor(cx, cy-1); err != nil && oy > 0 {
if err := v.SetOrigin(ox, oy-1); err != nil {
return err
}
}
}
return nil
}
示例3: getCursorListPos
//getCursorListPos returns the position of selection in the given view
func (c *CUI) getCursorListPos(g *gocui.Gui, v *gocui.View) (y int) {
_, oy := v.Origin()
_, cy := v.Cursor()
y = oy + cy
return
}