MCPcopy Create free account
hub / github.com/cogentcore/core / ApplyDeltaTransform

Method ApplyDeltaTransform

svg/path.go:947–958  ·  view source on GitHub ↗

ApplyDeltaTransform applies the given 2D delta transforms to the geometry of this node relative to given point. Trans translation and point are in top-level coordinates, so must be transformed into local coords first. Point is upper left corner of selection box that anchors the translation and scal

(sv *SVG, trans math32.Vector2, scale math32.Vector2, rot float32, pt math32.Vector2)

Source from the content-addressed store, hash-verified

945// Point is upper left corner of selection box that anchors the translation and scaling,
946// and for rotation it is the center point around which to rotate
947func (g *Path) ApplyDeltaTransform(sv *SVG, trans math32.Vector2, scale math32.Vector2, rot float32, pt math32.Vector2) {
948 crot := g.Paint.Transform.ExtractRot()
949 if rot != 0 || crot != 0 {
950 xf, lpt := g.DeltaTransform(trans, scale, rot, pt, false) // exclude self
951 g.Paint.Transform.SetMulCenter(xf, lpt)
952 g.SetProperty("transform", g.Paint.Transform.String())
953 } else {
954 xf, lpt := g.DeltaTransform(trans, scale, rot, pt, true) // include self
955 g.ApplyTransformImpl(xf, lpt)
956 g.GradientApplyTransformPt(sv, xf, lpt)
957 }
958}
959
960// ApplyTransformImpl does the implementation of applying a transform to all points
961func (g *Path) ApplyTransformImpl(xf math32.Matrix2, lpt math32.Vector2) {

Callers

nothing calls this directly

Calls 7

ApplyTransformImplMethod · 0.95
ExtractRotMethod · 0.80
DeltaTransformMethod · 0.80
SetMulCenterMethod · 0.80
SetPropertyMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected