Use the inverse pixel transform when clipping and getting pixel data
This commit is contained in:
@@ -5,7 +5,6 @@ import {DEVICE_PIXEL_RATIO} from './has.js';
|
|||||||
import {
|
import {
|
||||||
apply as applyTransform,
|
apply as applyTransform,
|
||||||
create as createTransform,
|
create as createTransform,
|
||||||
invert as invertTransform,
|
|
||||||
multiply as multiplyTransform,
|
multiply as multiplyTransform,
|
||||||
scale as scaleTransform
|
scale as scaleTransform
|
||||||
} from './transform.js';
|
} from './transform.js';
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import RenderEvent from '../../render/Event.js';
|
|||||||
import RenderEventType from '../../render/EventType.js';
|
import RenderEventType from '../../render/EventType.js';
|
||||||
import {rotateAtOffset} from '../../render/canvas.js';
|
import {rotateAtOffset} from '../../render/canvas.js';
|
||||||
import LayerRenderer from '../Layer.js';
|
import LayerRenderer from '../Layer.js';
|
||||||
import {invert as invertTransform, create as createTransform, apply as applyTransform, compose as composeTransform} from '../../transform.js';
|
import {create as createTransform, apply as applyTransform, compose as composeTransform} from '../../transform.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract
|
* @abstract
|
||||||
@@ -112,8 +112,7 @@ class CanvasLayerRenderer extends LayerRenderer {
|
|||||||
applyTransform(frameState.coordinateToPixelTransform, bottomRight);
|
applyTransform(frameState.coordinateToPixelTransform, bottomRight);
|
||||||
applyTransform(frameState.coordinateToPixelTransform, bottomLeft);
|
applyTransform(frameState.coordinateToPixelTransform, bottomLeft);
|
||||||
|
|
||||||
const inverted = invertTransform(this.pixelTransform_.slice());
|
const inverted = this.inversePixelTransform_;
|
||||||
|
|
||||||
applyTransform(inverted, topLeft);
|
applyTransform(inverted, topLeft);
|
||||||
applyTransform(inverted, topRight);
|
applyTransform(inverted, topRight);
|
||||||
applyTransform(inverted, bottomRight);
|
applyTransform(inverted, bottomRight);
|
||||||
@@ -190,7 +189,7 @@ class CanvasLayerRenderer extends LayerRenderer {
|
|||||||
* returned, and empty array will be returned.
|
* returned, and empty array will be returned.
|
||||||
*/
|
*/
|
||||||
getDataAtPixel(pixel, frameState, hitTolerance) {
|
getDataAtPixel(pixel, frameState, hitTolerance) {
|
||||||
const renderPixel = applyTransform(invertTransform(this.pixelTransform_.slice()), pixel.slice());
|
const renderPixel = applyTransform(this.inversePixelTransform_, pixel.slice());
|
||||||
const context = this.context;
|
const context = this.context;
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import {
|
|||||||
apply as applyTransform,
|
apply as applyTransform,
|
||||||
create as createTransform,
|
create as createTransform,
|
||||||
compose as composeTransform,
|
compose as composeTransform,
|
||||||
invert as invertTransform,
|
|
||||||
reset as resetTransform,
|
reset as resetTransform,
|
||||||
scale as scaleTransform,
|
scale as scaleTransform,
|
||||||
translate as translateTransform,
|
translate as translateTransform,
|
||||||
@@ -555,7 +554,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderPixel = applyTransform(invertTransform(this.overlayPixelTransform_.slice()), pixel.slice());
|
const renderPixel = applyTransform(this.inverseOverlayPixelTransform_, pixel.slice());
|
||||||
const context = this.overlayContext_;
|
const context = this.overlayContext_;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user