Skip to content

Commit

Permalink
Rewrite the getBaseViewLayer method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Reina committed Oct 2, 2024
1 parent 9d49bf4 commit d5ddabf
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/gui/layerGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,20 @@ export class LayerGroup {
* @returns {ViewLayer|undefined} The layer.
*/
getBaseViewLayer() {
let layer;
if (this.#layers[0] instanceof ViewLayer) {
layer = this.#layers[0];
// use first layer as base for calculating position and
// line sizes
let baseLayer;
for (const layer of this.#layers) {
if (layer instanceof ViewLayer) {
baseLayer = layer;
break;
}
}
return layer;
if (typeof baseLayer === 'undefined') {
logger.warn('No layer found');
return;
}
return baseLayer;
}

/**
Expand Down

0 comments on commit d5ddabf

Please sign in to comment.