Make the immediate API work with a user projection
This commit is contained in:
@@ -5,7 +5,6 @@ import {getUid} from '../util.js';
|
||||
import ImageState from '../ImageState.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
import BuilderType from '../render/canvas/BuilderType.js';
|
||||
import {getUserProjection} from '../proj.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -93,11 +92,11 @@ function renderCircleGeometry(builderGroup, geometry, style, feature) {
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
* @param {import("../proj/Projection.js").default} [projection] The view projection.
|
||||
* @param {import("../proj.js").TransformFunction} [opt_transform] Transform from user to view projection.
|
||||
* @return {boolean} `true` if style is loading.
|
||||
* @template T
|
||||
*/
|
||||
export function renderFeature(replayGroup, feature, style, squaredTolerance, listener, projection) {
|
||||
export function renderFeature(replayGroup, feature, style, squaredTolerance, listener, opt_transform) {
|
||||
let loading = false;
|
||||
const imageStyle = style.getImage();
|
||||
if (imageStyle) {
|
||||
@@ -113,7 +112,7 @@ export function renderFeature(replayGroup, feature, style, squaredTolerance, lis
|
||||
loading = true;
|
||||
}
|
||||
}
|
||||
renderFeatureInternal(replayGroup, feature, style, squaredTolerance, projection);
|
||||
renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform);
|
||||
|
||||
return loading;
|
||||
}
|
||||
@@ -124,14 +123,14 @@ export function renderFeature(replayGroup, feature, style, squaredTolerance, lis
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @param {import("../proj/Projection.js").default} [projection] The view projection.
|
||||
* @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
|
||||
*/
|
||||
function renderFeatureInternal(replayGroup, feature, style, squaredTolerance, projection) {
|
||||
function renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform) {
|
||||
const geometry = style.getGeometryFunction()(feature);
|
||||
if (!geometry) {
|
||||
return;
|
||||
}
|
||||
const simplifiedGeometry = geometry.simplifyTransformed(squaredTolerance, getUserProjection(), projection);
|
||||
const simplifiedGeometry = geometry.simplifyTransformed(squaredTolerance, opt_transform);
|
||||
const renderer = style.getRenderer();
|
||||
if (renderer) {
|
||||
renderGeometry(replayGroup, simplifiedGeometry, style, feature);
|
||||
|
||||
Reference in New Issue
Block a user