mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
ui: rename TransformOp.Mul to Multiply and split InvTransform
Multiply is a bit longer but more clear. InvTransform was really two operations: Invert and Transform. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -56,19 +56,23 @@ func (r *InvalidateOp) Decode(d []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
// Offset the transformation.
|
||||
func (t TransformOp) Offset(o f32.Point) TransformOp {
|
||||
return t.Mul(TransformOp{o})
|
||||
return t.Multiply(TransformOp{o})
|
||||
}
|
||||
|
||||
func (t TransformOp) InvTransform(p f32.Point) f32.Point {
|
||||
return p.Sub(t.offset)
|
||||
// Invert the transformation.
|
||||
func (t TransformOp) Invert() TransformOp {
|
||||
return TransformOp{offset: t.offset.Mul(-1)}
|
||||
}
|
||||
|
||||
// Transform a point.
|
||||
func (t TransformOp) Transform(p f32.Point) f32.Point {
|
||||
return p.Add(t.offset)
|
||||
}
|
||||
|
||||
func (t TransformOp) Mul(t2 TransformOp) TransformOp {
|
||||
// Multiply by a transformation.
|
||||
func (t TransformOp) Multiply(t2 TransformOp) TransformOp {
|
||||
return TransformOp{
|
||||
offset: t.offset.Add(t2.offset),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user