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

Method StyleCSS

svg/node.go:379–386  ·  view source on GitHub ↗

StyleCSS applies css style properties to given SVG node parsing out type, .class, and #name selectors

(sv *SVG, css map[string]any)

Source from the content-addressed store, hash-verified

377// StyleCSS applies css style properties to given SVG node
378// parsing out type, .class, and #name selectors
379func (g *NodeBase) StyleCSS(sv *SVG, css map[string]any) {
380 tyn := strings.ToLower(g.NodeType().Name) // type is most general, first
381 g.ApplyCSS(sv, tyn, css)
382 cln := "." + strings.ToLower(g.Class) // then class
383 g.ApplyCSS(sv, cln, css)
384 idnm := "#" + strings.ToLower(g.Name) // then name
385 g.ApplyCSS(sv, idnm, css)
386}
387
388// LocalBBoxToWin converts a local bounding box to SVG coordinates
389func (g *NodeBase) LocalBBoxToWin(bb math32.Box2) image.Rectangle {

Callers 1

StyleMethod · 0.95

Calls 2

NodeTypeMethod · 0.95
ApplyCSSMethod · 0.95

Tested by

no test coverage detected