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

Method GradientUpdateNodePoints

svg/gradient.go:267–284  ·  view source on GitHub ↗

GradientUpdateNodePoints updates the points for node based on current bbox

(n Node, prop string)

Source from the content-addressed store, hash-verified

265
266// GradientUpdateNodePoints updates the points for node based on current bbox
267func (sv *SVG) GradientUpdateNodePoints(n Node, prop string) {
268 ps := n.AsTree().Property(prop)
269 if ps == nil {
270 return
271 }
272 pstr := ps.(string)
273 url := "url(#"
274 if !strings.HasPrefix(pstr, url) {
275 return
276 }
277 gr := sv.GradientByName(n, pstr)
278 if gr == nil {
279 return
280 }
281 gb := gr.Grad.AsBase()
282 gb.SetBox(n.LocalBBox())
283 gb.SetTransform(math32.Identity2())
284}
285
286// GradientCloneNodeProp creates a new clone of the existing gradient for node
287// if set for given property key ("fill" or "stroke").

Callers

nothing calls this directly

Calls 8

GradientByNameMethod · 0.95
Identity2Function · 0.92
PropertyMethod · 0.80
SetBoxMethod · 0.80
AsTreeMethod · 0.65
AsBaseMethod · 0.65
LocalBBoxMethod · 0.65
SetTransformMethod · 0.45

Tested by

no test coverage detected