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 rect = this.timeIndicator.getBoundingClientRect();
|
||||||
const sheetLeft = this.sheetWindow.getBoundingClientRect().left;
|
const sheetLeft = this.sheetWindow.getBoundingClientRect().left;
|
||||||
|
const sheetRight = this.sheetWindow.getBoundingClientRect().right;
|
||||||
const xPosition = rect.left + window.scrollX - sheetLeft;
|
const xPosition = rect.left + window.scrollX - sheetLeft;
|
||||||
|
|
||||||
const canvasEntry = this.canvases[this.currStaveNumber - 1];
|
const canvasEntry = this.canvases[this.currStaveNumber - 1];
|
||||||
|
|
@ -91,6 +92,8 @@ export class Renderer {
|
||||||
const width = instrument.width * this.iconScale;
|
const width = instrument.width * this.iconScale;
|
||||||
const height = instrument.height * this.iconScale;
|
const height = instrument.height * this.iconScale;
|
||||||
|
|
||||||
|
if(xPosition + width > sheetRight) xPosition -= width;
|
||||||
|
|
||||||
ctx.drawImage(instrument.image, xPosition, y, width, height);
|
ctx.drawImage(instrument.image, xPosition, y, width, height);
|
||||||
|
|
||||||
this.iconCache.push({
|
this.iconCache.push({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue