Skip to content

Commit

Permalink
Account for SpanNode when computing maxWidth of horizontal label, see p…
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jan 20, 2021
1 parent 3e01f34 commit e222a36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/SeismographNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SeismographNode extends XYChartNode {
numberHorizontalLines: 5,
numberVerticalLines: 5,

// {Node} - label for the horizontal axis, layout adjusted to accomodate the span Node of the Seismograph,
// {Node} - label for the horizontal axis, layout adjusted to accommodate the span Node of the Seismograph,
// otherwise passed to supertype
horizontalAxisLabelNode: null,

Expand Down Expand Up @@ -186,6 +186,7 @@ class SeismographNode extends XYChartNode {
if ( options.horizontalAxisLabelNode ) {
if ( options.horizontalAxisLabelNode.left < spanNode.right + HORIZONTAL_AXIS_LABEL_MARGIN ) {
options.horizontalAxisLabelNode.left = spanNode.right + HORIZONTAL_AXIS_LABEL_MARGIN;
options.horizontalAxisLabelNode.maxWidth = this.chartWidth - spanNode.width - HORIZONTAL_AXIS_LABEL_MARGIN;
}
}

Expand Down

0 comments on commit e222a36

Please sign in to comment.