icons that would otherwise be clipped are placed within the canvas bounds
This commit is contained in:
parent
52fcdfa1ba
commit
169da90607
|
|
@ -79,6 +79,7 @@ export class Renderer {
|
|||
|
||||
const rect = this.timeIndicator.getBoundingClientRect();
|
||||
const sheetLeft = this.sheetWindow.getBoundingClientRect().left;
|
||||
const sheetRight = this.sheetWindow.getBoundingClientRect().right;
|
||||
const xPosition = rect.left + window.scrollX - sheetLeft;
|
||||
|
||||
const canvasEntry = this.canvases[this.currStaveNumber - 1];
|
||||
|
|
@ -91,6 +92,8 @@ export class Renderer {
|
|||
const width = instrument.width * this.iconScale;
|
||||
const height = instrument.height * this.iconScale;
|
||||
|
||||
if(xPosition + width > sheetRight) xPosition -= width;
|
||||
|
||||
ctx.drawImage(instrument.image, xPosition, y, width, height);
|
||||
|
||||
this.iconCache.push({
|
||||
|
|
|
|||
Loading…
Reference in New Issue