fix: correctly manage the markers fill style (#157)

Previously, when setting startFill/endFill, the display was inverted
comparing to the configuration.
The marker was filled when set to false, not filled when set to true.
When not set, the marker was filled, which is the expected default.

The issue came from a wrong condition to manage the default value and
was reproduced with the Markers Story.

In addition to the code fix, update the Markers.stories.js to fix style
configurations
  - use number instead of string for markers size
  - use boolean instead of number for start/end fill
development
Thomas Bouffard 2023-01-06 16:53:54 +01:00 committed by GitHub
parent a247b38268
commit 3fff754cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -112,7 +112,7 @@ class ConnectorShape extends PolylineShape {
// Allow for stroke width in the end point used and the
// orthogonal vectors describing the direction of the marker
const filled = !(source ? this.style.startFill : this.style.endFill);
const filled = (source ? this.style.startFill : this.style.endFill) ?? true;
result = MarkerShape.createMarker(
c,

View File

@ -135,15 +135,14 @@ const Template = ({ label, ...args }) => {
style.fillColor = '#FFFFFF';
style.strokeColor = '#000000';
style.fontColor = '#000000';
style.fontStyle = '1';
style.fontStyle = 1;
style = graph.getStylesheet().getDefaultEdgeStyle();
style.strokeColor = '#000000';
style.fontColor = '#000000';
style.fontStyle = '0';
style.fontStyle = '0';
style.startSize = '8';
style.endSize = '8';
style.fontStyle = 0;
style.startSize = 8;
style.endSize = 8;
// Populates the graph
const parent = graph.getDefaultParent();
@ -156,8 +155,8 @@ const Template = ({ label, ...args }) => {
startArrow: 'oval',
endArrow: 'block',
sourcePerimeterSpacing: 4,
startFill: 0,
endFill: 0,
startFill: false,
endFill: false,
});
const e11 = graph.insertVertex(e1, null, 'Label', 0, 0, 20, 14, {
shape: 'message',