diff --git a/emer/layer.go b/emer/layer.go index a955803..e6db55f 100644 --- a/emer/layer.go +++ b/emer/layer.go @@ -36,12 +36,10 @@ type Layer interface { // SetName sets name of layer SetName(nm string) - // SetClass sets CSS-style class name(s) for this layer (space-separated if multiple) - SetClass(cls string) - // AddClass adds a CSS-style class name(s) for this layer, // ensuring that it is not a duplicate, and properly space separated. - AddClass(cls string) + // Returns Layer so it can be chained to set other properties too + AddClass(cls ...string) Layer // IsOff returns true if layer has been turned Off (lesioned) -- for experimentation IsOff() bool diff --git a/emer/prjn.go b/emer/prjn.go index 29a3d62..5b8ac99 100644 --- a/emer/prjn.go +++ b/emer/prjn.go @@ -52,13 +52,10 @@ type Prjn interface { // Connect sets the basic connection parameters for this projection (send, recv, pattern, and type) // Connect(send, recv Layer, pat prjn.Pattern, typ PrjnType) - // SetClass sets CSS-style class name(s) for this projection (space-separated if multiple) - // Returns Prjn so it can be chained to set other properties too - SetClass(cls string) Prjn - // AddClass adds a CSS-style class name(s) for this prjn, // ensuring that it is not a duplicate, and properly space separated. - AddClass(cls string) + // Returns Prjn so it can be chained to set other properties too + AddClass(cls ...string) Prjn // Label satisfies the gi.Labeler interface for getting the name of objects generically Label() string diff --git a/params/styler.go b/params/styler.go index 3ed26c7..4d14e64 100644 --- a/params/styler.go +++ b/params/styler.go @@ -40,16 +40,17 @@ type StylerObj interface { Object() any } -// AddClass adds given class to current class string, +// AddClass adds given class(es) to current class string, // ensuring it is not a duplicate of existing, and properly // adding spaces -func AddClass(cur, class string) string { - if ClassMatch(cur, class) { +func AddClass(cur string, class ...string) string { + cls := strings.Join(class, " ") + if ClassMatch(cur, cls) { return cur } cur = strings.TrimSpace(cur) if len(cur) == 0 { - return class + return cls } - return cur + " " + class + return cur + " " + cls }