Skip to content

Commit

Permalink
fix(core): canvas sizing when it doesn't fill the whole container
Browse files Browse the repository at this point in the history
Overhang was erroneously added twice.
  • Loading branch information
tuner committed Mar 12, 2024
1 parent 3aeb8dd commit 393cab5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
5 changes: 2 additions & 3 deletions packages/core/src/genomeSpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
checkForDuplicateScaleNames,
setImplicitScaleNames,
calculateCanvasSize,
calculateViewRootSize,
} from "./view/viewUtils.js";
import UnitView from "./view/unitView.js";

Expand Down Expand Up @@ -365,7 +364,7 @@ export default class GenomeSpy {
canvasWrapper,
() =>
this.viewRoot
? calculateCanvasSize(calculateViewRootSize(this.viewRoot))
? calculateCanvasSize(this.viewRoot.getSize())
: { width: undefined, height: undefined },
this.spec.background,
{ powerPreference: this.options.powerPreference ?? "default" }
Expand Down Expand Up @@ -542,7 +541,7 @@ export default class GenomeSpy {
);

this.#canvasWrapper.style.flexGrow =
calculateViewRootSize(this.viewRoot).height.grow > 0 ? "1" : "0";
this.viewRoot.getSize().height.grow > 0 ? "1" : "0";

this.#initializeParameterBindings();

Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/view/viewUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,6 @@ export function findUniqueViewNames(root) {
*/
export const isCustomViewName = (name) => !/^(layer|concat)\d+$/.test(name);

/**
* @param {View} viewRoot
*/
export function calculateViewRootSize(viewRoot) {
return viewRoot.getSize().addPadding(viewRoot.getOverhang());
}

/**
* @param {import("./layout/flexLayout.js").FlexDimensions} viewRootSize
*/
Expand Down

0 comments on commit 393cab5

Please sign in to comment.