mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-13 11:09:39 +02:00
Merge pull request #32 from Mermaid-Chart/shape-theme-styling-issue-fix
fixed issues of border radius and styling, label padding
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
import type { Node, RectOptions } from '../../types.js';
|
import type { Node, RectOptions } from '../../types.js';
|
||||||
import type { D3Selection } from '../../../types.js';
|
import type { D3Selection } from '../../../types.js';
|
||||||
import { drawRect } from './drawRect.js';
|
import { drawRect } from './drawRect.js';
|
||||||
|
import { getConfig } from '../../../config.js';
|
||||||
|
|
||||||
export async function roundedRect<T extends SVGGraphicsElement>(
|
export async function roundedRect<T extends SVGGraphicsElement>(
|
||||||
parent: D3Selection<T>,
|
parent: D3Selection<T>,
|
||||||
node: Node
|
node: Node
|
||||||
) {
|
) {
|
||||||
|
const { themeVariables } = getConfig();
|
||||||
|
const { radius } = themeVariables;
|
||||||
const nodePadding = node.padding ?? 0;
|
const nodePadding = node.padding ?? 0;
|
||||||
let labelPaddingX = 0;
|
let labelPaddingX = 0;
|
||||||
let labelPaddingY = 0;
|
let labelPaddingY = 0;
|
||||||
@@ -16,10 +19,10 @@ export async function roundedRect<T extends SVGGraphicsElement>(
|
|||||||
case 'neo':
|
case 'neo':
|
||||||
labelPaddingX = 16;
|
labelPaddingX = 16;
|
||||||
labelPaddingY = 12;
|
labelPaddingY = 12;
|
||||||
rx = ry = 12;
|
rx = ry = radius;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
labelPaddingX = nodePadding * 2;
|
labelPaddingX = nodePadding;
|
||||||
labelPaddingY = nodePadding;
|
labelPaddingY = nodePadding;
|
||||||
rx = ry = 5;
|
rx = ry = 5;
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ class Theme {
|
|||||||
this.mainBkg = '#ECECFF';
|
this.mainBkg = '#ECECFF';
|
||||||
this.secondBkg = '#ffffde';
|
this.secondBkg = '#ffffde';
|
||||||
this.lineColor = '#333333';
|
this.lineColor = '#333333';
|
||||||
this.border1 = '#9370DB';
|
this.border1 = '#B8B8FF';
|
||||||
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
||||||
this.border2 = '#aaaa33';
|
this.border2 = '#aaaa33';
|
||||||
this.arrowheadColor = '#333333';
|
this.arrowheadColor = '#333333';
|
||||||
|
@@ -21,7 +21,7 @@ class Theme {
|
|||||||
this.noteTextColor = '#28253D';
|
this.noteTextColor = '#28253D';
|
||||||
|
|
||||||
this.THEME_COLOR_LIMIT = 12;
|
this.THEME_COLOR_LIMIT = 12;
|
||||||
this.radius = 3;
|
this.radius = 12;
|
||||||
this.strokeWidth = 2;
|
this.strokeWidth = 2;
|
||||||
|
|
||||||
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
||||||
|
Reference in New Issue
Block a user