Upgrade to v2.7 Fyne API v2.7
package fyne Animation Animation AnimationCurve AnimationCurve App App AppMetadata AppMetadata BuildType BuildType Canvas Canvas CanvasObject CanvasObject Clipboard Clipboard CloudProvider CloudProvider CloudProviderPreferences CloudProviderPreferences CloudProviderStorage CloudProviderStorage Container Container Delta Delta Device Device DeviceOrientation DeviceOrientation Disableable Disableable DoubleTappable DoubleTappable DragEvent DragEvent Draggable Draggable Driver Driver Focusable Focusable HardwareKey HardwareKey KeyboardShortcut KeyboardShortcut KeyEvent KeyEvent KeyModifier KeyModifier KeyName KeyName Layout Layout LegacyTheme LegacyTheme Lifecycle Lifecycle ListableURI ListableURI Locale Locale MainMenu MainMenu Menu Menu MenuItem MenuItem Notification Notification OverlayStack OverlayStack PointEvent PointEvent Position Position Preferences Preferences Resource Resource Scrollable Scrollable ScrollDirection ScrollDirection ScrollEvent ScrollEvent SecondaryTappable SecondaryTappable Settings Settings Shortcut Shortcut Shortcutable Shortcutable ShortcutCopy ShortcutCopy ShortcutCut ShortcutCut ShortcutHandler ShortcutHandler ShortcutPaste ShortcutPaste ShortcutRedo ShortcutRedo ShortcutSelectAll ShortcutSelectAll ShortcutUndo ShortcutUndo Size Size StaticResource StaticResource Storage Storage StringValidator StringValidator Tabbable Tabbable Tappable Tappable TextAlign TextAlign TextStyle TextStyle TextTruncation TextTruncation TextWrap TextWrap Theme Theme ThemeColorName ThemeColorName ThemedResource ThemedResource ThemeIconName ThemeIconName ThemeSizeName ThemeSizeName ThemeVariant ThemeVariant URI URI URIReadCloser URIReadCloser URIWithIcon URIWithIcon URIWriteCloser URIWriteCloser Validatable Validatable Vector2 Vector2 Widget Widget WidgetRenderer WidgetRenderer Window Window
app canvas container data/binding data/validation dialog driver driver/desktop driver/embedded driver/mobile driver/software lang layout storage storage/repository test theme widget

Fyne API "fyne.Size"

fyne.Size


import "fyne.io/fyne/v2"

Usage

type Size

type Size struct {
	Width  float32 // The number of units along the X axis.
	Height float32 // The number of units along the Y axis.
}

Size describes something with width and height.

func MeasureText

func MeasureText(text string, size float32, style TextStyle) Size

MeasureText uses the current driver to calculate the size of text when rendered. The font used will be read from the current app’s theme.

func NewSize

func NewSize(w float32, h float32) Size

NewSize returns a newly allocated Size of the specified dimensions.

func NewSquareSize

func NewSquareSize(side float32) Size

NewSquareSize returns a newly allocated Size with the same width and height.

Since: 2.4

func (Size) Add

func (s Size) Add(v Vector2) Size

Add returns a new Size that is the result of increasing the current size by s2 Width and Height.

func (Size) AddWidthHeight

func (s Size) AddWidthHeight(width, height float32) Size

AddWidthHeight returns a new Size by adding width and height to the current one.

func (Size) Components

func (s Size) Components() (float32, float32)

Components returns the Width and Height elements of this Size

func (Size) IsZero

func (s Size) IsZero() bool

IsZero returns whether the Size has zero width and zero height.

func (Size) Max

func (s Size) Max(v Vector2) Size

Max returns a new [Size] that is the maximum of the current Size and s2.

func (Size) Min

func (s Size) Min(v Vector2) Size

Min returns a new [Size] that is the minimum of s and v.

func (Size) Subtract

func (s Size) Subtract(v Vector2) Size

Subtract returns a new Size that is the result of decreasing the current size by s2 Width and Height.

func (Size) SubtractWidthHeight

func (s Size) SubtractWidthHeight(width, height float32) Size

SubtractWidthHeight returns a new Size by subtracting width and height from the current one.