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)
| 92 | // Point is upper left corner of selection box that anchors the translation and scaling, |
| 93 | // and for rotation it is the center point around which to rotate |
| 94 | func (g *Rect) ApplyDeltaTransform(sv *SVG, trans math32.Vector2, scale math32.Vector2, rot float32, pt math32.Vector2) { |
| 95 | crot := g.Paint.Transform.ExtractRot() |
| 96 | if rot != 0 || crot != 0 { |
| 97 | xf, lpt := g.DeltaTransform(trans, scale, rot, pt, false) // exclude self |
| 98 | g.Paint.Transform.SetMulCenter(xf, lpt) // todo: this might be backwards for everything |
| 99 | g.SetProperty("transform", g.Paint.Transform.String()) |
| 100 | } else { |
| 101 | // fmt.Println("adt", trans, scale, rot, pt) |
| 102 | xf, lpt := g.DeltaTransform(trans, scale, rot, pt, true) // include self |
| 103 | // opos := g.Pos |
| 104 | g.Pos = xf.MulVector2AsPointCenter(g.Pos, lpt) |
| 105 | // fmt.Println("apply delta trans:", opos, g.Pos, xf) |
| 106 | g.Size = xf.MulVector2AsVector(g.Size) |
| 107 | g.GradientApplyTransformPt(sv, xf, lpt) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // WriteGeom writes the geometry of the node to a slice of floating point numbers |
| 112 | // the length and ordering of which is specific to each node type. |
nothing calls this directly
no test coverage detected