removed theming code from styling methods
This commit is contained in:
parent
66dc978418
commit
1e89c33cee
2 changed files with 0 additions and 40 deletions
|
|
@ -163,16 +163,6 @@ type Shape struct {
|
||||||
func (s Shape) CSSStyle() string {
|
func (s Shape) CSSStyle() string {
|
||||||
out := ""
|
out := ""
|
||||||
|
|
||||||
if s.Type == ShapeSQLTable || s.Type == ShapeClass {
|
|
||||||
// Fill is used for header fill in these types
|
|
||||||
// This fill property is just background of rows
|
|
||||||
out += fmt.Sprintf(`fill:%s;`, s.Stroke)
|
|
||||||
// Stroke (border) of these shapes should match the header fill
|
|
||||||
out += fmt.Sprintf(`stroke:%s;`, s.Fill)
|
|
||||||
} else {
|
|
||||||
out += fmt.Sprintf(`fill:%s;`, s.Fill)
|
|
||||||
out += fmt.Sprintf(`stroke:%s;`, s.Stroke)
|
|
||||||
}
|
|
||||||
out += fmt.Sprintf(`opacity:%f;`, s.Opacity)
|
out += fmt.Sprintf(`opacity:%f;`, s.Opacity)
|
||||||
out += fmt.Sprintf(`stroke-width:%d;`, s.StrokeWidth)
|
out += fmt.Sprintf(`stroke-width:%d;`, s.StrokeWidth)
|
||||||
if s.StrokeDash != 0 {
|
if s.StrokeDash != 0 {
|
||||||
|
|
@ -278,7 +268,6 @@ func BaseConnection() *Connection {
|
||||||
func (c Connection) CSSStyle() string {
|
func (c Connection) CSSStyle() string {
|
||||||
out := ""
|
out := ""
|
||||||
|
|
||||||
out += fmt.Sprintf(`stroke:%s;`, c.Stroke)
|
|
||||||
out += fmt.Sprintf(`opacity:%f;`, c.Opacity)
|
out += fmt.Sprintf(`opacity:%f;`, c.Opacity)
|
||||||
out += fmt.Sprintf(`stroke-width:%d;`, c.StrokeWidth)
|
out += fmt.Sprintf(`stroke-width:%d;`, c.StrokeWidth)
|
||||||
strokeDash := c.StrokeDash
|
strokeDash := c.StrokeDash
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,9 @@
|
||||||
package style
|
package style
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"oss.terrastruct.com/d2/d2target"
|
"oss.terrastruct.com/d2/d2target"
|
||||||
"oss.terrastruct.com/d2/lib/svg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ShapeStyle(shape d2target.Shape) string {
|
|
||||||
out := ""
|
|
||||||
|
|
||||||
out += fmt.Sprintf(`opacity:%f;`, shape.Opacity)
|
|
||||||
out += fmt.Sprintf(`stroke-width:%d;`, shape.StrokeWidth)
|
|
||||||
if shape.StrokeDash != 0 {
|
|
||||||
dashSize, gapSize := svg.GetStrokeDashAttributes(float64(shape.StrokeWidth), shape.StrokeDash)
|
|
||||||
out += fmt.Sprintf(`stroke-dasharray:%f,%f;`, dashSize, gapSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
func ShapeTheme(shape d2target.Shape) (fill, stroke string) {
|
func ShapeTheme(shape d2target.Shape) (fill, stroke string) {
|
||||||
if shape.Type == d2target.ShapeSQLTable || shape.Type == d2target.ShapeClass {
|
if shape.Type == d2target.ShapeSQLTable || shape.Type == d2target.ShapeClass {
|
||||||
// Fill is used for header fill in these types
|
// Fill is used for header fill in these types
|
||||||
|
|
@ -34,19 +18,6 @@ func ShapeTheme(shape d2target.Shape) (fill, stroke string) {
|
||||||
return fill, stroke
|
return fill, stroke
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConnectionStyle(connection d2target.Connection) string {
|
|
||||||
out := ""
|
|
||||||
|
|
||||||
out += fmt.Sprintf(`opacity:%f;`, connection.Opacity)
|
|
||||||
out += fmt.Sprintf(`stroke-width:%d;`, connection.StrokeWidth)
|
|
||||||
if connection.StrokeDash != 0 {
|
|
||||||
dashSize, gapSize := svg.GetStrokeDashAttributes(float64(connection.StrokeWidth), connection.StrokeDash)
|
|
||||||
out += fmt.Sprintf(`stroke-dasharray:%f,%f;`, dashSize, gapSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
func ConnectionTheme(connection d2target.Connection) (stroke string) {
|
func ConnectionTheme(connection d2target.Connection) (stroke string) {
|
||||||
return connection.Stroke
|
return connection.Stroke
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue