Skip to content

Commit

Permalink
can pass in optionally font_size and font_family as props to BaseAlig…
Browse files Browse the repository at this point in the history
…nment
  • Loading branch information
g12342jn committed Jun 13, 2022
1 parent 16d32fe commit 5dc1d3a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/BaseAlignment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ class BaseAlignment extends Component {
}
draw(x_pixel, y_pixel) {
if (this.props.disableVerticalScrolling) y_pixel = 0;
const { width, height, site_size, molecule } = this.props,
const {
width,
height,
site_size,
molecule,
font_family,
font_size
} = this.props,
start_site = Math.floor(x_pixel / site_size),
end_site = Math.ceil((x_pixel + width) / site_size),
start_seq = Math.floor(y_pixel / site_size),
Expand Down Expand Up @@ -78,7 +85,7 @@ class BaseAlignment extends Component {
})
);
const context = document.getElementById(this.canvas_id).getContext("2d");
context.font = `${this.props.font_size} ${this.props.font_family}`;
context.font = `${font_size} ${font_family}`;
context.textAlign = "center";
context.textBaseline = "middle";
context.setTransform(1, 0, 0, 1, -x_pixel, -y_pixel);
Expand Down

0 comments on commit 5dc1d3a

Please sign in to comment.