package size
import "fyne.io/fyne/v2/internal/driver/mobile/event/size"
Package size defines an event for the dimensions, physical resolution and orientation of the app's window.
See the golang.org/x/mobile/app package for details on the event model.
Index ¶
Types ¶
type Event ¶
type Event struct { // WidthPx and HeightPx are the window's dimensions in pixels. WidthPx, HeightPx int // WidthPt and HeightPt are the window's physical dimensions in points // (1/72 of an inch). // // The values are based on PixelsPerPt and are therefore approximate, as // per the comment on PixelsPerPt. WidthPt, HeightPt float32 // PixelsPerPt is the window's physical resolution. It is the number of // pixels in a single float32. // // There are a wide variety of pixel densities in existing phones and // tablets, so apps should be written to expect various non-integer // PixelsPerPt values. // // The value is approximate, in that the OS, drivers or hardware may report // approximate or quantized values. An N x N pixel square should be roughly // 1 square inch for N = int(PixelsPerPt * 72), although different square // lengths (in pixels) might be closer to 1 inch in practice. Nonetheless, // this PixelsPerPt value should be consistent with e.g. the ratio of // WidthPx to WidthPt. PixelsPerPt float32 // Orientation is the orientation of the device screen. Orientation Orientation // InsetTopPx, InsetBottomPx, InsetLeftPx and InsetRightPx define the size of any border area in pixels. // These values define how far in from the screen edge any controls should be drawn. // The inset can be caused by status bars, button overlays or devices cutouts. InsetTopPx, InsetBottomPx, InsetLeftPx, InsetRightPx int // DarkMode is set to true if this window is currently shown in the OS configured dark / night mode. DarkMode bool }
Event holds the dimensions, physical resolution and orientation of the app's window.
func (Event) Bounds ¶
Bounds returns the window's bounds in pixels, at the time this size event was sent.
The top-left pixel is always (0, 0). The bottom-right pixel is given by the width and height.
func (Event) Size ¶
Size returns the window's size in pixels, at the time this size event was sent.
type Orientation ¶
type Orientation int
Orientation is the orientation of the device screen.
const ( // OrientationUnknown means device orientation cannot be determined. // // Equivalent on Android to Configuration.ORIENTATION_UNKNOWN // and on iOS to: // UIDeviceOrientationUnknown // UIDeviceOrientationFaceUp // UIDeviceOrientationFaceDown OrientationUnknown Orientation = iota // OrientationPortrait is a device oriented so it is tall and thin. // // Equivalent on Android to Configuration.ORIENTATION_PORTRAIT // and on iOS to: // UIDeviceOrientationPortrait // UIDeviceOrientationPortraitUpsideDown OrientationPortrait // OrientationLandscape is a device oriented so it is short and wide. // // Equivalent on Android to Configuration.ORIENTATION_LANDSCAPE // and on iOS to: // UIDeviceOrientationLandscapeLeft // UIDeviceOrientationLandscapeRight OrientationLandscape )
Source Files ¶
size.go
- Version
- v2.4.0-rc1
- Published
- Aug 25, 2023
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 12 minutes ago –
Tools for package owners.