mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #3798 from brendandahl/intersect-bbox
Intersect group bounding box with the current canvas dimensions.
This commit is contained in:
commit
19485c34c8
3 changed files with 12 additions and 0 deletions
|
@ -1506,6 +1506,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||
var bounds = Util.getAxialAlignedBoundingBox(
|
||||
group.bbox,
|
||||
currentCtx.mozCurrentTransform);
|
||||
// Clip the bounding box to the current canvas.
|
||||
bounds = Util.intersect(bounds, [0,
|
||||
0,
|
||||
currentCtx.canvas.width,
|
||||
currentCtx.canvas.height]);
|
||||
// Use ceil in case we're between sizes so we don't create canvas that is
|
||||
// too small and make the canvas at least 1x1 pixels.
|
||||
var drawnWidth = Math.max(Math.ceil(bounds[2] - bounds[0]), 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue