1 Star 0 Fork 21

丁延超 / Fyne

forked from Gitee 极速下载 / Fyne 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
device.go 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
package fyne
// DeviceOrientation represents the different ways that a mobile device can be held
type DeviceOrientation int
const (
// OrientationVertical is the default vertical orientation
OrientationVertical DeviceOrientation = iota
// OrientationVerticalUpsideDown is the portrait orientation held upside down
OrientationVerticalUpsideDown
// OrientationHorizontalLeft is used to indicate a landscape orientation with the top to the left
OrientationHorizontalLeft
// OrientationHorizontalRight is used to indicate a landscape orientation with the top to the right
OrientationHorizontalRight
)
// IsVertical is a helper utility that determines if a passed orientation is vertical
func IsVertical(orient DeviceOrientation) bool {
return orient == OrientationVertical || orient == OrientationVerticalUpsideDown
}
// IsHorizontal is a helper utility that determines if a passed orientation is horizontal
func IsHorizontal(orient DeviceOrientation) bool {
return !IsVertical(orient)
}
// Device provides information about the devices the code is running on
type Device interface {
Orientation() DeviceOrientation
IsMobile() bool
HasKeyboard() bool
SystemScaleForWindow(Window) float32
}
// CurrentDevice returns the device information for the current hardware (via the driver)
func CurrentDevice() Device {
return CurrentApp().Driver().Device()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/chao0225/Fyne.git
git@gitee.com:chao0225/Fyne.git
chao0225
Fyne
Fyne
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891