fix placeholder positioning for canvas drawer

This commit is contained in:
Tom 2024-02-09 17:18:54 -05:00
parent d4e82d374e
commit c734de531f

View File

@ -382,9 +382,9 @@ class CanvasDrawer extends OpenSeadragon.DrawerBase{
} }
usedClip = true; usedClip = true;
} }
tiledImage._hasOpaqueTile = false;
if ( tiledImage.placeholderFillStyle && 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) { if (sketchScale) {
placeholderRect = placeholderRect.times(sketchScale); placeholderRect = placeholderRect.times(sketchScale);
} }
@ -392,7 +392,7 @@ class CanvasDrawer extends OpenSeadragon.DrawerBase{
placeholderRect = placeholderRect.translate(sketchTranslate); placeholderRect = placeholderRect.translate(sketchTranslate);
} }
var fillStyle = null; let fillStyle = null;
if ( typeof tiledImage.placeholderFillStyle === "function" ) { if ( typeof tiledImage.placeholderFillStyle === "function" ) {
fillStyle = tiledImage.placeholderFillStyle(tiledImage, this.context); fillStyle = tiledImage.placeholderFillStyle(tiledImage, this.context);
} }
@ -402,7 +402,9 @@ class CanvasDrawer extends OpenSeadragon.DrawerBase{
this._drawRectangle(placeholderRect, fillStyle, useSketch); this._drawRectangle(placeholderRect, fillStyle, useSketch);
} }
if(!window.draw){
lastDrawn = [];
}
var subPixelRoundingRule = determineSubPixelRoundingRule(tiledImage.subPixelRoundingForTransparency); var subPixelRoundingRule = determineSubPixelRoundingRule(tiledImage.subPixelRoundingForTransparency);
var shouldRoundPositionAndSize = false; var shouldRoundPositionAndSize = false;