math

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package math resizes inner dimensions to fit inside outer ones while keeping the original aspect ratio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Math

type Math struct{}

Math resizes dimensions while keeping their aspect ratio. It holds no state.

func New

func New() *Math

New create a Math.

func (*Math) GetCenterCorrection

func (s *Math) GetCenterCorrection(outerSize, innerSize float64) float64

GetCenterCorrection return the correction of space in X or Y to centralize a line in relation with another line.

func (*Math) GetInnerCenterCell

func (s *Math) GetInnerCenterCell(inner, outer *entity.Dimensions) *entity.Cell

GetInnerCenterCell define a inner cell formatted inside outer cell centered.

func (*Math) Resize

func (s *Math) Resize(inner, outer *entity.Dimensions, percent float64, justReferenceWidth bool) *entity.Dimensions

Resize adjusts the internal dimension of an element to occupy a percentage of the available space

  • inner: The inner dimensions of the element
  • outer: The outer dimensions of the element
  • percent: The percentage of the external dimension that can be occupied
  • justReferenceWidth: Indicates whether resizing should be done only in relation to width or in relation to width and height

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL