@longline/aqua-ui 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,11 +25,21 @@ interface IProps {
|
|
|
25
25
|
* @default #35ABE2
|
|
26
26
|
*/
|
|
27
27
|
contourColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Minimum zoom level at which to render layer.
|
|
30
|
+
* @default 0
|
|
31
|
+
*/
|
|
32
|
+
minZoom?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum zoom level at which to render layer.
|
|
35
|
+
* @default 99
|
|
36
|
+
*/
|
|
37
|
+
maxZoom?: number;
|
|
28
38
|
}
|
|
29
39
|
/**
|
|
30
40
|
* An `InterpolationLayer` takes a data array of the form `{ latitude, longitude, value }`. It performs triangulation
|
|
31
41
|
* and draws the data in an OpenGL layer. Optionally, a number of contour `levels` can be set to draw contour lines.
|
|
32
42
|
* Gradient colors are configurable using `gradientStops`.
|
|
33
43
|
*/
|
|
34
|
-
declare const InterpolationLayer: ({ levels, contourColor, gradientStops, ...props }: IProps) => React.JSX.Element;
|
|
44
|
+
declare const InterpolationLayer: ({ levels, contourColor, gradientStops, minZoom, maxZoom, ...props }: IProps) => React.JSX.Element;
|
|
35
45
|
export { InterpolationLayer };
|
|
@@ -218,9 +218,13 @@ var InterpolationLayerBase = function (props) {
|
|
|
218
218
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
219
219
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
220
220
|
};
|
|
221
|
-
var onRender = function (gl, matrix, width, height) {
|
|
221
|
+
var onRender = function (gl, matrix, zoom, width, height) {
|
|
222
222
|
// Render is called many times while the map is panned/zoomed.
|
|
223
223
|
// You cannot have access to the map though.
|
|
224
|
+
if (zoom < props.minZoom)
|
|
225
|
+
return;
|
|
226
|
+
if (zoom > props.maxZoom)
|
|
227
|
+
return;
|
|
224
228
|
// Bind & clear framebuffer, then render levels into it:
|
|
225
229
|
// It is crucial to set the viewport size to match the resolution of the
|
|
226
230
|
// texture we're rendering into.
|
|
@@ -239,7 +243,7 @@ var InterpolationLayerBase = function (props) {
|
|
|
239
243
|
// @ts-ignore
|
|
240
244
|
, {
|
|
241
245
|
// @ts-ignore
|
|
242
|
-
type: "custom", beforeId: "overlay", key: time, onAdd: onAddLayer, render: function (gl, matrix) { return onRender(gl, matrix, map.current.getContainer().clientWidth, map.current.getContainer().clientHeight); } }));
|
|
246
|
+
type: "custom", beforeId: "overlay", key: time, onAdd: onAddLayer, render: function (gl, matrix) { return onRender(gl, matrix, map.current.getZoom(), map.current.getContainer().clientWidth, map.current.getContainer().clientHeight); } }));
|
|
243
247
|
};
|
|
244
248
|
/**
|
|
245
249
|
* An `InterpolationLayer` takes a data array of the form `{ latitude, longitude, value }`. It performs triangulation
|
|
@@ -250,7 +254,7 @@ var InterpolationLayer = function (_a) {
|
|
|
250
254
|
var _b = _a.levels, levels = _b === void 0 ? 0 : _b, _c = _a.contourColor, contourColor = _c === void 0 ? '#35ABE2' : _c, _d = _a.gradientStops, gradientStops = _d === void 0 ? [
|
|
251
255
|
{ pos: 0.0, color: '#0000ffff' },
|
|
252
256
|
{ pos: 1.0, color: '#000000ff' }
|
|
253
|
-
] : _d, props = __rest(_a, ["levels", "contourColor", "gradientStops"]);
|
|
254
|
-
return React.createElement(InterpolationLayerBase, __assign({ levels: levels, contourColor: contourColor, gradientStops: gradientStops }, props));
|
|
257
|
+
] : _d, _e = _a.minZoom, minZoom = _e === void 0 ? 0 : _e, _f = _a.maxZoom, maxZoom = _f === void 0 ? 99 : _f, props = __rest(_a, ["levels", "contourColor", "gradientStops", "minZoom", "maxZoom"]);
|
|
258
|
+
return React.createElement(InterpolationLayerBase, __assign({ levels: levels, contourColor: contourColor, gradientStops: gradientStops, minZoom: minZoom, maxZoom: maxZoom }, props));
|
|
255
259
|
};
|
|
256
260
|
export { InterpolationLayer };
|
|
@@ -36,6 +36,16 @@ interface IProps {
|
|
|
36
36
|
* @default 1.0
|
|
37
37
|
*/
|
|
38
38
|
pointSize?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Minimum zoom level at which to render layer.
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
minZoom?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Maximum zoom level at which to render layer.
|
|
46
|
+
* @default 99
|
|
47
|
+
*/
|
|
48
|
+
maxZoom?: number;
|
|
39
49
|
}
|
|
40
|
-
declare const ParticlesLayer: ({ particles, density, delay, gradientStops, ...props }: IProps) => React.JSX.Element;
|
|
50
|
+
declare const ParticlesLayer: ({ particles, density, delay, gradientStops, minZoom, maxZoom, ...props }: IProps) => React.JSX.Element;
|
|
41
51
|
export { ParticlesLayer };
|
|
@@ -303,7 +303,11 @@ var ParticlesLayerBase = function (props) {
|
|
|
303
303
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
304
304
|
gl.drawArrays(gl.POINTS, 0, props.density * props.density * props.particles);
|
|
305
305
|
};
|
|
306
|
-
var onRender = function (gl, matrix, width, height) {
|
|
306
|
+
var onRender = function (gl, matrix, zoom, width, height) {
|
|
307
|
+
if (zoom < props.minZoom)
|
|
308
|
+
return;
|
|
309
|
+
if (zoom > props.maxZoom)
|
|
310
|
+
return;
|
|
307
311
|
gl.useProgram(uvProgram.current);
|
|
308
312
|
// Render U-texture:
|
|
309
313
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fboU.current);
|
|
@@ -328,7 +332,7 @@ var ParticlesLayerBase = function (props) {
|
|
|
328
332
|
// @ts-ignore
|
|
329
333
|
, {
|
|
330
334
|
// @ts-ignore
|
|
331
|
-
type: "custom", beforeId: "overlay", key: time, onAdd: onAddLayer, render: function (gl, matrix) { return onRender(gl, matrix, map.current.getContainer().clientWidth, map.current.getContainer().clientHeight); } }));
|
|
335
|
+
type: "custom", beforeId: "overlay", key: time, onAdd: onAddLayer, render: function (gl, matrix) { return onRender(gl, matrix, map.current.getZoom(), map.current.getContainer().clientWidth, map.current.getContainer().clientHeight); } }));
|
|
332
336
|
};
|
|
333
337
|
var ParticlesLayer = function (_a) {
|
|
334
338
|
var _b = _a.particles, particles = _b === void 0 ? 80 : _b, _c = _a.density, density = _c === void 0 ? 40 : _c, _d = _a.delay, delay = _d === void 0 ? 0 : _d, _e = _a.gradientStops, gradientStops = _e === void 0 ? [
|
|
@@ -336,7 +340,7 @@ var ParticlesLayer = function (_a) {
|
|
|
336
340
|
{ pos: 0.25, color: '#5c5cffff' },
|
|
337
341
|
{ pos: 0.5, color: '#5c5cff00' },
|
|
338
342
|
{ pos: 1.0, color: '#5c5cff00' }, // transparent blue
|
|
339
|
-
] : _e, props = __rest(_a, ["particles", "density", "delay", "gradientStops"]);
|
|
340
|
-
return React.createElement(ParticlesLayerBase, __assign({ particles: particles, density: density, gradientStops: gradientStops, delay: delay }, props));
|
|
343
|
+
] : _e, _f = _a.minZoom, minZoom = _f === void 0 ? 0 : _f, _g = _a.maxZoom, maxZoom = _g === void 0 ? 99 : _g, props = __rest(_a, ["particles", "density", "delay", "gradientStops", "minZoom", "maxZoom"]);
|
|
344
|
+
return React.createElement(ParticlesLayerBase, __assign({ particles: particles, density: density, gradientStops: gradientStops, delay: delay, minZoom: minZoom, maxZoom: maxZoom }, props));
|
|
341
345
|
};
|
|
342
346
|
export { ParticlesLayer };
|