Skip to content

Commit 03e01fe

Browse files
committed
feat: add map.options.cameraNearScale to adjust map.cameraNear
1 parent f9d6407 commit 03e01fe

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/maptalks/src/map/Map.Camera.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ Map.include(/** @lends Map.prototype */{
723723
const fov = this.getFov() * Math.PI / 180;
724724
const farZ = this._getCameraFar(fov, this.getPitch());
725725
this.cameraFar = farZ;
726-
this.cameraNear = this.cameraCenterDistance / 20;
726+
this.cameraNear = this.cameraCenterDistance / 20 * this.options['cameraNearScale'];
727727
// camera projection matrix
728728
const projMatrix = this.projMatrix || createMat4();
729729
const isWebGPU = this.options.renderer === 'gpu';

packages/maptalks/src/map/Map.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ const options: MapOptionsType = {
170170
'maxFPS': 0,
171171
'debug': false,
172172
'cameraFarUndergroundInMeter': 2000,
173+
'cameraNearScale': 1,
173174

174175
'onlyWebGL1': false,
175176
'forceRedrawPerFrame': false,
@@ -2944,6 +2945,7 @@ export type MapOptionsType = {
29442945
forceRedrawPerFrame?: boolean;
29452946
extensions?: string[];
29462947
optionalExtensions?: string[];
2948+
cameraNearScale?: number;
29472949
}
29482950

29492951
export type MapCreateOptionsType = {

0 commit comments

Comments
 (0)