Consider area around viewport for decluttering
This commit is contained in:
@@ -69,7 +69,7 @@ class Executor {
|
|||||||
* @param {number} pixelRatio Pixel ratio.
|
* @param {number} pixelRatio Pixel ratio.
|
||||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
* @param {boolean} overlaps The replay can have overlapping geometries.
|
||||||
* @param {SerializableInstructions} instructions The serializable instructions
|
* @param {SerializableInstructions} instructions The serializable instructions
|
||||||
* @param {number} renderBuffer Render buffer in pixels.
|
* @param {import("../../size.js").Size} renderBuffer Render buffer (width/height) in pixels.
|
||||||
*/
|
*/
|
||||||
constructor(resolution, pixelRatio, overlaps, instructions, renderBuffer) {
|
constructor(resolution, pixelRatio, overlaps, instructions, renderBuffer) {
|
||||||
/**
|
/**
|
||||||
@@ -120,6 +120,10 @@ class Executor {
|
|||||||
*/
|
*/
|
||||||
this.coordinateCache_ = {};
|
this.coordinateCache_ = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {import("../../size.js").Size}
|
||||||
|
*/
|
||||||
this.renderBuffer_ = renderBuffer;
|
this.renderBuffer_ = renderBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -400,6 +404,14 @@ class Executor {
|
|||||||
} else {
|
} else {
|
||||||
createOrUpdate(boxX, boxY, boxX + boxW, boxY + boxH, tmpExtent);
|
createOrUpdate(boxX, boxY, boxX + boxW, boxY + boxH, tmpExtent);
|
||||||
}
|
}
|
||||||
|
this.renderBuffer_[0] = Math.max(
|
||||||
|
this.renderBuffer_[0],
|
||||||
|
getWidth(tmpExtent)
|
||||||
|
);
|
||||||
|
this.renderBuffer_[1] = Math.max(
|
||||||
|
this.renderBuffer_[1],
|
||||||
|
getHeight(tmpExtent)
|
||||||
|
);
|
||||||
const canvas = context.canvas;
|
const canvas = context.canvas;
|
||||||
const strokePadding = strokeInstruction
|
const strokePadding = strokeInstruction
|
||||||
? (strokeInstruction[2] * scale) / 2
|
? (strokeInstruction[2] * scale) / 2
|
||||||
@@ -407,11 +419,11 @@ class Executor {
|
|||||||
const renderBuffer = this.renderBuffer_;
|
const renderBuffer = this.renderBuffer_;
|
||||||
const intersects =
|
const intersects =
|
||||||
tmpExtent[0] - strokePadding <=
|
tmpExtent[0] - strokePadding <=
|
||||||
(canvas.width + renderBuffer) / contextScale &&
|
(canvas.width + renderBuffer[0]) / contextScale &&
|
||||||
tmpExtent[2] + strokePadding >= -renderBuffer / contextScale &&
|
tmpExtent[2] + strokePadding >= -renderBuffer[0] / contextScale &&
|
||||||
tmpExtent[1] - strokePadding <=
|
tmpExtent[1] - strokePadding <=
|
||||||
(canvas.height + renderBuffer) / contextScale &&
|
(canvas.height + renderBuffer[1]) / contextScale &&
|
||||||
tmpExtent[3] + strokePadding >= -renderBuffer / contextScale;
|
tmpExtent[3] + strokePadding >= -renderBuffer[1] / contextScale;
|
||||||
|
|
||||||
if (snapToPixel) {
|
if (snapToPixel) {
|
||||||
x = Math.round(x);
|
x = Math.round(x);
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ class ExecutorGroup {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number|undefined}
|
* @type {import("../../size.js").Size|undefined}
|
||||||
*/
|
*/
|
||||||
this.renderBuffer_ = opt_renderBuffer || 0;
|
this.renderBuffer_ = [opt_renderBuffer || 0, opt_renderBuffer || 0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
Reference in New Issue
Block a user