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

Method GradientDeleteNodeProp

svg/gradient.go:315–325  ·  view source on GitHub ↗

GradientDeleteNodeProp deletes any existing gradient for node if set for given property key ("fill" or "stroke"). Returns true if deleted.

(n Node, prop string)

Source from the content-addressed store, hash-verified

313// if set for given property key ("fill" or "stroke").
314// Returns true if deleted.
315func (sv *SVG) GradientDeleteNodeProp(n Node, prop string) bool {
316 ps := n.AsTree().Property(prop)
317 if ps == nil {
318 return false
319 }
320 pstr := ps.(string)
321 if !strings.HasPrefix(pstr, "url(#radialGradient") && !strings.HasPrefix(pstr, "url(#linearGradient") {
322 return false
323 }
324 return sv.GradientDeleteForNode(n, pstr)
325}
326
327// GradientUpdateAllStops removes any items from Defs that are not actually referred to
328// by anything in the current SVG tree. Returns true if items were removed.

Callers

nothing calls this directly

Calls 3

GradientDeleteForNodeMethod · 0.95
PropertyMethod · 0.80
AsTreeMethod · 0.65

Tested by

no test coverage detected