Skip to content

Commit

Permalink
Draw blank square for unpgraphable mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Mar 1, 2024
1 parent 6c0ae5c commit 1fe9ff8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/fontra/views/fontinfo/panel-axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,6 @@ customElements.define("axis-box", AxisBox);

function buildMappingGraph(axisController) {
const axis = axisController.model;
// if (!axis.mapping.length) {
// return html.div(); // filler
// }
const marginLeft = 16;
const marginRight = 16;
const marginTop = 16;
Expand All @@ -387,6 +384,13 @@ function buildMappingGraph(axisController) {
const graphSize = 100;
const width = graphSize + marginLeft + marginRight;
const height = graphSize + marginTop + marginBottom;

if (!axis.mapping?.length || axis.mapping.length < 2) {
return html.div({
style: `width: ${width}px; height: ${height}px;background-color: #AAA1;`,
}); // filler for non-graphable mapping
}

const xs = axis.mapping?.map(([x, y]) => x) || [];
const ys = axis.mapping?.map(([x, y]) => y) || [];
const xMin = Math.min(...xs);
Expand Down

0 comments on commit 1fe9ff8

Please sign in to comment.