Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

satellite-view

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satellite-view - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

39

dist/satellite-view.js

@@ -8,4 +8,9 @@ function setParams(userParams) {

flipY = false,
units = "radians",
} = userParams;
if (!context || !(context.gl instanceof WebGLRenderingContext)) {
throw "satellite-view: no valid WebGLRenderingContext!";
}
const getPixelRatio = (pixelRatio)

@@ -18,11 +23,9 @@ ? () => userParams.pixelRatio

const maps = Array.isArray(map)
? map
: [map];
const maps = Array.isArray(map) ? map : [map];
if (!context || !(context.gl instanceof WebGLRenderingContext)) {
throw "satellite-view: no valid WebGLRenderingContext!";
}
const unitsPerRad = (units === "degrees")
? 180.0 / Math.PI
: 1.0;
return { context, getPixelRatio, globeRadius, maps, flipY };
return { context, getPixelRatio, globeRadius, maps, flipY, unitsPerRad };
}

@@ -243,7 +246,8 @@

const maxMercLat = 2.0 * Math.atan( Math.exp(Math.PI) ) - Math.PI / 2.0;
function init(userParams) {
const { PI, cos, sin, tan, atan, exp, min, max } = Math;
const maxMercLat = 2.0 * atan(exp(PI)) - PI / 2.0;
function init(userParams) {
const params = setParams(userParams);
const { context, maps, globeRadius } = params;
const { context, maps, globeRadius, unitsPerRad } = params;

@@ -270,11 +274,11 @@ // Initialize shader program

// Set uniforms related to camera position
const lat = camPos[1];
const lat = camPos[1] / unitsPerRad;
setters.uLat0(lat);
setters.uCosLat0(Math.cos(lat));
setters.uSinLat0(Math.sin(lat));
setters.uTanLat0(Math.tan(lat));
setters.uCosLat0(cos(lat));
setters.uSinLat0(sin(lat));
setters.uTanLat0(tan(lat));
const clipLat = Math.min(Math.max(-maxMercLat, lat), maxMercLat);
const clipLat = min(max(-maxMercLat, lat), maxMercLat);
setters.uLatErr(lat - clipLat);
setters.uExpY0(Math.tan(Math.PI / 4 + clipLat / 2));
setters.uExpY0(tan(PI / 4 + clipLat / 2));

@@ -290,7 +294,4 @@ setters.uHnorm(camPos[2] / globeRadius);

const resized = context.resizeCanvasToDisplaySize(params.getPixelRatio());
context.bindFramebufferAndSetViewport();
context.gl.pixelStorei(context.gl.UNPACK_FLIP_Y_WEBGL, params.flipY);
context.clear();

@@ -297,0 +298,0 @@ context.draw({ vao });

{
"version": "2.0.3",
"version": "2.1.0",
"files": [

@@ -24,3 +24,3 @@ "dist"

"tile-rack": "^0.2.1",
"tile-setter": "^0.0.8",
"tile-setter": "^0.0.9",
"yawgl": "^0.3.3"

@@ -27,0 +27,0 @@ },

@@ -31,8 +31,8 @@ # satellite-view

satelliteView.init takes a parameters object with the following properties:
- context: (REQUIRED) An extended WebGL rendering context, as returned by the
- `context`: (REQUIRED) An extended WebGL rendering context, as returned by the
initContext method from [yawgl][]
- globeRadius: The (floating point) radius of the spherical Earth. Units must
- `globeRadius`: The (floating point) radius of the spherical Earth. Units must
match the units of the altitude in the camPos array supplied to the draw
method. Default: 6371 (km).
- map: (REQUIRED) An object with the following properties, OR an array of
- `map`: (REQUIRED) An object with the following properties, OR an array of
objects where each element has the following properties:

@@ -47,3 +47,3 @@ - canvas: an HTML Canvas element containing a map image

since the last draw call
- pixelRatio: Ratio of the pixel size of the rendered image ([drawingbuffer
- `pixelRatio`: Ratio of the pixel size of the rendered image ([drawingbuffer
size]) to the CSS display size of the container. Default:

@@ -53,2 +53,4 @@ [window.devicePixelRatio][]. Note: if a value is supplied, the pixel ratio

the pixel ratio when window.devicePixelRatio changes
- `units`: Specify "degrees" or "radians" as the units of the longitude and
latitude in the camPos argument of any future draw calls. Default: "radians"

@@ -65,4 +67,4 @@ [yawgl]: https://github.com/GlobeletJS/yawgl

- camPos: a 3-element array containing the longitude, latitude, altitude of
the camera. Longitude and latitude are in radians. Altitude is in the same
units as the supplied globe radius.
the camera. Longitude and latitude are in the units specified on
initialization. Altitude is in the same units as the supplied globe radius.
- maxRayTan: a 2-element array containing the maximum ray tangents at the

@@ -69,0 +71,0 @@ corners of the camera sensor. The values are the tangents of half the field

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc