From c734de531fd94cbbd912f96be046b953ccf65399 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 9 Feb 2024 17:18:54 -0500 Subject: [PATCH] fix placeholder positioning for canvas drawer --- src/canvasdrawer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/canvasdrawer.js b/src/canvasdrawer.js index d4ec6231..2ec6b17b 100644 --- a/src/canvasdrawer.js +++ b/src/canvasdrawer.js @@ -382,9 +382,9 @@ class CanvasDrawer extends OpenSeadragon.DrawerBase{ } usedClip = true; } - + tiledImage._hasOpaqueTile = false; if ( tiledImage.placeholderFillStyle && tiledImage._hasOpaqueTile === false ) { - var placeholderRect = this.viewportToDrawerRectangle(tiledImage.getBounds(true)); + let placeholderRect = this.viewportToDrawerRectangle(tiledImage.getBoundsNoRotate(true)); if (sketchScale) { placeholderRect = placeholderRect.times(sketchScale); } @@ -392,7 +392,7 @@ class CanvasDrawer extends OpenSeadragon.DrawerBase{ placeholderRect = placeholderRect.translate(sketchTranslate); } - var fillStyle = null; + let fillStyle = null; if ( typeof tiledImage.placeholderFillStyle === "function" ) { fillStyle = tiledImage.placeholderFillStyle(tiledImage, this.context); } @@ -402,7 +402,9 @@ class CanvasDrawer extends OpenSeadragon.DrawerBase{ this._drawRectangle(placeholderRect, fillStyle, useSketch); } - + if(!window.draw){ + lastDrawn = []; + } var subPixelRoundingRule = determineSubPixelRoundingRule(tiledImage.subPixelRoundingForTransparency); var shouldRoundPositionAndSize = false;