@math.gl/web-mercator
Advanced tools
Comparing version 3.4.2 to 3.4.3
@@ -9,2 +9,3 @@ import { Bounds, FitBoundsOptions } from "./fit-bounds"; | ||
longitude?: number; | ||
position?: number[]; | ||
zoom?: number; | ||
@@ -32,2 +33,3 @@ pitch?: number; | ||
meterOffset: number[]; | ||
center: number[]; | ||
@@ -34,0 +36,0 @@ |
@@ -32,2 +32,4 @@ "use strict"; | ||
var vec3 = _interopRequireWildcard(require("gl-matrix/vec3")); | ||
var WebMercatorViewport = function () { | ||
@@ -53,2 +55,4 @@ function WebMercatorViewport() { | ||
altitude = _ref$altitude === void 0 ? 1.5 : _ref$altitude, | ||
_ref$position = _ref.position, | ||
position = _ref$position === void 0 ? null : _ref$position, | ||
_ref$nearZMultiplier = _ref.nearZMultiplier, | ||
@@ -64,4 +68,13 @@ nearZMultiplier = _ref$nearZMultiplier === void 0 ? 0.02 : _ref$nearZMultiplier, | ||
altitude = Math.max(0.75, altitude); | ||
var distanceScales = (0, _webMercatorUtils.getDistanceScales)({ | ||
longitude: longitude, | ||
latitude: latitude | ||
}); | ||
var center = (0, _webMercatorUtils.lngLatToWorld)([longitude, latitude]); | ||
center[2] = 0; | ||
if (position) { | ||
vec3.add(center, center, vec3.mul([], position, distanceScales.unitsPerMeter)); | ||
} | ||
this.projectionMatrix = (0, _webMercatorUtils.getProjectionMatrix)({ | ||
@@ -93,3 +106,4 @@ width: width, | ||
this.center = center; | ||
this.distanceScales = (0, _webMercatorUtils.getDistanceScales)(this); | ||
this.meterOffset = position || [0, 0, 0]; | ||
this.distanceScales = distanceScales; | ||
@@ -96,0 +110,0 @@ this._initMatrices(); |
@@ -9,2 +9,3 @@ import { Bounds, FitBoundsOptions } from "./fit-bounds"; | ||
longitude?: number; | ||
position?: number[]; | ||
zoom?: number; | ||
@@ -32,2 +33,3 @@ pitch?: number; | ||
meterOffset: number[]; | ||
center: number[]; | ||
@@ -34,0 +36,0 @@ |
@@ -7,2 +7,3 @@ import { createMat4 } from './math-utils'; | ||
import * as vec2 from 'gl-matrix/vec2'; | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
export default class WebMercatorViewport { | ||
@@ -18,2 +19,3 @@ constructor({ | ||
altitude = 1.5, | ||
position = null, | ||
nearZMultiplier = 0.02, | ||
@@ -29,4 +31,13 @@ farZMultiplier = 1.01 | ||
altitude = Math.max(0.75, altitude); | ||
const distanceScales = getDistanceScales({ | ||
longitude, | ||
latitude | ||
}); | ||
const center = lngLatToWorld([longitude, latitude]); | ||
center[2] = 0; | ||
if (position) { | ||
vec3.add(center, center, vec3.mul([], position, distanceScales.unitsPerMeter)); | ||
} | ||
this.projectionMatrix = getProjectionMatrix({ | ||
@@ -58,3 +69,4 @@ width, | ||
this.center = center; | ||
this.distanceScales = getDistanceScales(this); | ||
this.meterOffset = position || [0, 0, 0]; | ||
this.distanceScales = distanceScales; | ||
@@ -61,0 +73,0 @@ this._initMatrices(); |
@@ -9,2 +9,3 @@ import { Bounds, FitBoundsOptions } from "./fit-bounds"; | ||
longitude?: number; | ||
position?: number[]; | ||
zoom?: number; | ||
@@ -32,2 +33,3 @@ pitch?: number; | ||
meterOffset: number[]; | ||
center: number[]; | ||
@@ -34,0 +36,0 @@ |
@@ -11,2 +11,3 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
import * as vec2 from 'gl-matrix/vec2'; | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
@@ -33,2 +34,4 @@ var WebMercatorViewport = function () { | ||
altitude = _ref$altitude === void 0 ? 1.5 : _ref$altitude, | ||
_ref$position = _ref.position, | ||
position = _ref$position === void 0 ? null : _ref$position, | ||
_ref$nearZMultiplier = _ref.nearZMultiplier, | ||
@@ -45,4 +48,13 @@ nearZMultiplier = _ref$nearZMultiplier === void 0 ? 0.02 : _ref$nearZMultiplier, | ||
altitude = Math.max(0.75, altitude); | ||
var distanceScales = getDistanceScales({ | ||
longitude: longitude, | ||
latitude: latitude | ||
}); | ||
var center = lngLatToWorld([longitude, latitude]); | ||
center[2] = 0; | ||
if (position) { | ||
vec3.add(center, center, vec3.mul([], position, distanceScales.unitsPerMeter)); | ||
} | ||
this.projectionMatrix = getProjectionMatrix({ | ||
@@ -74,3 +86,4 @@ width: width, | ||
this.center = center; | ||
this.distanceScales = getDistanceScales(this); | ||
this.meterOffset = position || [0, 0, 0]; | ||
this.distanceScales = distanceScales; | ||
@@ -77,0 +90,0 @@ this._initMatrices(); |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"keywords": [ | ||
@@ -38,3 +38,3 @@ "webgl", | ||
}, | ||
"gitHead": "29b92300bea8fc1b5c3fcca61302324c0bd578c7" | ||
"gitHead": "62c9a8e945634e30bf2f97cb11898140cde87dc0" | ||
} |
@@ -9,2 +9,3 @@ import { Bounds, FitBoundsOptions } from "./fit-bounds"; | ||
longitude?: number; | ||
position?: number[]; | ||
zoom?: number; | ||
@@ -32,2 +33,3 @@ pitch?: number; | ||
meterOffset: number[]; | ||
center: number[]; | ||
@@ -34,0 +36,0 @@ |
@@ -19,2 +19,3 @@ // View and Projection Matrix calculations for mapbox-js style map view properties | ||
import * as vec2 from 'gl-matrix/vec2'; | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
@@ -34,2 +35,3 @@ export default class WebMercatorViewport { | ||
altitude = 1.5, | ||
position = null, | ||
nearZMultiplier = 0.02, | ||
@@ -48,5 +50,11 @@ farZMultiplier = 1.01 | ||
const distanceScales = getDistanceScales({longitude, latitude}); | ||
const center = lngLatToWorld([longitude, latitude]); | ||
center[2] = 0; | ||
if (position) { | ||
vec3.add(center, center, vec3.mul([], position, distanceScales.unitsPerMeter)); | ||
} | ||
this.projectionMatrix = getProjectionMatrix({ | ||
@@ -82,4 +90,5 @@ width, | ||
this.center = center; | ||
this.meterOffset = position || [0, 0, 0]; | ||
this.distanceScales = getDistanceScales(this); | ||
this.distanceScales = distanceScales; | ||
@@ -86,0 +95,0 @@ this._initMatrices(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
367943
4795