geojs 1.13.1 → 1.14.1
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.
- package/geo.js +56 -18
- package/geo.lean.js +56 -18
- package/geo.lean.min.js +2 -2
- package/geo.min.js +4 -4
- package/package.json +2 -2
- package/src/map.js +50 -12
- package/src/webgl/lineFeature.vert +26 -5
package/geo.js
CHANGED
|
@@ -18195,11 +18195,13 @@ var _map2 = function map(arg) {
|
|
|
18195
18195
|
* option when determining the new view.
|
|
18196
18196
|
* @param {boolean} [ignoreClampBounds] If `true`, ignore the clampBounds
|
|
18197
18197
|
* option when determining the new view.
|
|
18198
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan or zoom
|
|
18199
|
+
* event. If 'pan', only trigger the zoom event.
|
|
18198
18200
|
* @returns {number|this}
|
|
18199
18201
|
* @fires geo.event.zoom
|
|
18200
18202
|
* @fires geo.event.pan
|
|
18201
18203
|
*/
|
|
18202
|
-
this.zoom = function (val, origin, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
18204
|
+
this.zoom = function (val, origin, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
18203
18205
|
if (val === undefined) {
|
|
18204
18206
|
return m_zoom;
|
|
18205
18207
|
}
|
|
@@ -18224,22 +18226,52 @@ var _map2 = function map(arg) {
|
|
|
18224
18226
|
zoomLevel: m_zoom,
|
|
18225
18227
|
screenPosition: origin ? origin.map : undefined
|
|
18226
18228
|
};
|
|
18227
|
-
|
|
18229
|
+
if (!noTrigger || noTrigger === 'pan') {
|
|
18230
|
+
m_this.geoTrigger(geo_event.zoom, evt);
|
|
18231
|
+
}
|
|
18228
18232
|
if (aroundPoint) {
|
|
18229
18233
|
var shifted = m_this.gcsToDisplay(origin.mapgcs || origin.geo, origin.mapgcs ? null : undefined);
|
|
18230
18234
|
m_this.pan({
|
|
18231
18235
|
x: origin.map.x - shifted.x,
|
|
18232
18236
|
y: origin.map.y - shifted.y
|
|
18233
|
-
}, ignoreDiscreteZoom, true);
|
|
18237
|
+
}, ignoreDiscreteZoom, true, noTrigger);
|
|
18234
18238
|
} else {
|
|
18235
18239
|
m_this.pan({
|
|
18236
18240
|
x: 0,
|
|
18237
18241
|
y: 0
|
|
18238
|
-
}, ignoreDiscreteZoom, ignoreClampBounds);
|
|
18242
|
+
}, ignoreDiscreteZoom, ignoreClampBounds, noTrigger);
|
|
18239
18243
|
}
|
|
18240
18244
|
return m_this;
|
|
18241
18245
|
};
|
|
18242
18246
|
|
|
18247
|
+
/**
|
|
18248
|
+
* Set zoom level and center of the map.
|
|
18249
|
+
*
|
|
18250
|
+
* @param {number} zoom The new zoom level to set.
|
|
18251
|
+
* @param {geo.geoPosition} center The new center of the
|
|
18252
|
+
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
|
|
18253
|
+
* gcs, `null` to use the map gcs, or any other transform. The center is
|
|
18254
|
+
* converted from this gcs to the map projection.
|
|
18255
|
+
* @param {geo.geoPosition} origin.geo The gcs coordinates of the zoom
|
|
18256
|
+
* center.
|
|
18257
|
+
* @param {geo.screenPosition} origin.map The display coordinates of the zoom
|
|
18258
|
+
* center.
|
|
18259
|
+
* @param {boolean} [ignoreDiscreteZoom] If `true`, ignore the discreteZoom
|
|
18260
|
+
* option when determining the new view.
|
|
18261
|
+
* @param {boolean} [ignoreClampBounds] If `true`, ignore the clampBounds
|
|
18262
|
+
* option when determining the new view.
|
|
18263
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan or zoom
|
|
18264
|
+
* event.
|
|
18265
|
+
* @returns {this}
|
|
18266
|
+
* @fires geo.event.zoom
|
|
18267
|
+
* @fires geo.event.pan
|
|
18268
|
+
*/
|
|
18269
|
+
this.zoomAndCenter = function (zoom, center, gcs, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
18270
|
+
this.zoom(zoom, undefined, ignoreDiscreteZoom, ignoreClampBounds, noTrigger || 'pan');
|
|
18271
|
+
this.center(center, gcs, ignoreDiscreteZoom, ignoreClampBounds, noTrigger);
|
|
18272
|
+
return this;
|
|
18273
|
+
};
|
|
18274
|
+
|
|
18243
18275
|
/**
|
|
18244
18276
|
* Pan the map by a number of display pixels.
|
|
18245
18277
|
*
|
|
@@ -18253,10 +18285,11 @@ var _map2 = function map(arg) {
|
|
|
18253
18285
|
* view. When `'limited'`, the `clampBoundsX` and `clampBoundsY` options
|
|
18254
18286
|
* are selectively enforced so that the map will not end up more out of
|
|
18255
18287
|
* bounds than its current state.
|
|
18288
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan event.
|
|
18256
18289
|
* @returns {this}
|
|
18257
18290
|
* @fires geo.event.pan
|
|
18258
18291
|
*/
|
|
18259
|
-
this.pan = function (delta, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
18292
|
+
this.pan = function (delta, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
18260
18293
|
var evt = {
|
|
18261
18294
|
screenDelta: delta
|
|
18262
18295
|
};
|
|
@@ -18297,7 +18330,9 @@ var _map2 = function map(arg) {
|
|
|
18297
18330
|
x: m_width / 2,
|
|
18298
18331
|
y: m_height / 2
|
|
18299
18332
|
});
|
|
18300
|
-
|
|
18333
|
+
if (!noTrigger) {
|
|
18334
|
+
m_this.geoTrigger(geo_event.pan, evt);
|
|
18335
|
+
}
|
|
18301
18336
|
m_this.modified();
|
|
18302
18337
|
return m_this;
|
|
18303
18338
|
};
|
|
@@ -18359,7 +18394,7 @@ var _map2 = function map(arg) {
|
|
|
18359
18394
|
/**
|
|
18360
18395
|
* Get or set the center of the map in the given geographic coordinates.
|
|
18361
18396
|
*
|
|
18362
|
-
* @param {geo.geoPosition} coordinates If specified, the new center of the
|
|
18397
|
+
* @param {geo.geoPosition} [coordinates] If specified, the new center of the
|
|
18363
18398
|
* map.
|
|
18364
18399
|
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
|
|
18365
18400
|
* gcs, `null` to use the map gcs, or any other transform. If setting the
|
|
@@ -18372,10 +18407,11 @@ var _map2 = function map(arg) {
|
|
|
18372
18407
|
* view. When `'limited'`, the `clampBoundsX` and `clampBoundsY` options
|
|
18373
18408
|
* are selectively enforced so that the map will not end up more out of
|
|
18374
18409
|
* bounds than its current state.
|
|
18410
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan event.
|
|
18375
18411
|
* @returns {geo.geoPosition|this}
|
|
18376
18412
|
* @fires geo.event.pan
|
|
18377
18413
|
*/
|
|
18378
|
-
this.center = function (coordinates, gcs, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
18414
|
+
this.center = function (coordinates, gcs, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
18379
18415
|
var center;
|
|
18380
18416
|
if (coordinates === undefined) {
|
|
18381
18417
|
center = Object.assign({}, m_this.worldToGcs(m_center, gcs));
|
|
@@ -18387,12 +18423,14 @@ var _map2 = function map(arg) {
|
|
|
18387
18423
|
camera_bounds(m_this.boundsFromZoomAndCenter(m_zoom, center, m_rotation, null, ignoreDiscreteZoom, ignoreClampBounds), m_rotation);
|
|
18388
18424
|
m_this.modified();
|
|
18389
18425
|
// trigger a pan event
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18426
|
+
if (!noTrigger) {
|
|
18427
|
+
m_this.geoTrigger(geo_event.pan, {
|
|
18428
|
+
screenDelta: {
|
|
18429
|
+
x: 0,
|
|
18430
|
+
y: 0
|
|
18431
|
+
}
|
|
18432
|
+
});
|
|
18433
|
+
}
|
|
18396
18434
|
return m_this;
|
|
18397
18435
|
};
|
|
18398
18436
|
|
|
@@ -19151,7 +19189,7 @@ var _map2 = function map(arg) {
|
|
|
19151
19189
|
|
|
19152
19190
|
// This might have consequences in terms of bounds/zoom clamping.
|
|
19153
19191
|
// What behavior do we expect from this method in that case?
|
|
19154
|
-
m_this.zoom(nav.zoom);
|
|
19192
|
+
m_this.zoom(nav.zoom, undefined, undefined, undefined, 'pan');
|
|
19155
19193
|
m_this.center(nav.center, null);
|
|
19156
19194
|
}
|
|
19157
19195
|
return m_this.boundsFromZoomAndCenter(m_zoom, m_center, m_rotation, gcs, true);
|
|
@@ -28126,7 +28164,7 @@ module.exports = _sceneObject;
|
|
|
28126
28164
|
* @constant
|
|
28127
28165
|
* @type {string}
|
|
28128
28166
|
*/
|
|
28129
|
-
module.exports = "
|
|
28167
|
+
module.exports = "81c2c67b6f61c4292a790edab5e583c82095b099";
|
|
28130
28168
|
|
|
28131
28169
|
/***/ }),
|
|
28132
28170
|
|
|
@@ -40011,7 +40049,7 @@ module.exports = _vectorFeature;
|
|
|
40011
40049
|
* @constant
|
|
40012
40050
|
* @type {string}
|
|
40013
40051
|
*/
|
|
40014
|
-
module.exports = "1.
|
|
40052
|
+
module.exports = "1.14.1";
|
|
40015
40053
|
|
|
40016
40054
|
/***/ }),
|
|
40017
40055
|
|
|
@@ -75929,7 +75967,7 @@ module.exports = "/* lineFeature fragment shader */\n\n#ifdef GL_ES\n #ifdef GL
|
|
|
75929
75967
|
/***/ 9336:
|
|
75930
75968
|
/***/ (function(module) {
|
|
75931
75969
|
|
|
75932
|
-
module.exports = "/* lineFeature vertex shader */\n\n#ifdef GL_ES\n precision highp float;\n#endif\nattribute vec3 pos;\nattribute vec3 prev;\nattribute vec3 next;\nattribute vec3 far;\nattribute float flags;\n\nattribute vec3 strokeColor;\nattribute float strokeOpacity;\nattribute float strokeWidth;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float pixelWidth;\nuniform float aspect;\nuniform float miterLimit;\nuniform float antialiasing;\n\nvarying vec4 strokeColorVar;\nvarying vec4 subpos; /* px, py, length - px, width */\nvarying vec4 info; /* near mode, far mode, offset */\nvarying vec4 angles; /* near angle cos, sin, far angle cos, sin */\n\nconst float PI = 3.14159265358979323846264;\n\nvec4 viewCoord(vec3 c) {\n vec4 result = projectionMatrix * modelViewMatrix * vec4(c.xyz, 1.0);\n if (result.w != 0.0) result = result / result.w;\n return result;\n}\n\nfloat atan2(float y, float x) {\n if (x > 0.0) return atan(y / x);\n if (x < 0.0 && y >= 0.0) return atan(y / x) + PI;\n if (x < 0.0) return atan(y / x) - PI;\n return sign(y) * 0.5 * PI;\n}\n\nvoid main(void)\n{\n /* If any vertex has been deliberately set to a negative opacity,\n * skip doing computations on it. */\n if (strokeOpacity < 0.0) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n /* convert coordinates. We have four values, since we need to\n * calculate the angles between the lines formed by prev-pos and\n * pos-next, and between pos-next and next-far, plus know the angle\n * (prev)---(pos)---(next)---(far) => A---B---C---D */\n vec4 A = viewCoord(prev);\n vec4 B = viewCoord(pos);\n vec4 C = viewCoord(next);\n vec4 D = viewCoord(far);\n // calculate line segment vector and angle\n vec2 deltaCB = C.xy - B.xy;\n if (deltaCB == vec2(0.0, 0.0)) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n float angleCB = atan2(deltaCB.y, deltaCB.x * aspect);\n // values we need to pass along\n strokeColorVar = vec4(strokeColor, strokeOpacity);\n // extract values from our flags field\n int vertex = int(mod(flags, 4.0));\n int nearMode = int(mod(floor(flags / 4.0), 8.0));\n int farMode = int(mod(floor(flags / 32.0), 8.0));\n // we use 11 bits of the flags for the offset, where -1023 to 1023\n // maps to -1 to 1. The 11 bits are a signed value, so simply\n // selecting the bits will result in an unsigned values that may be\n // greater than 1, in which case we have to subtract appropriately.\n float offset = mod(floor(flags / 256.0), 2048.0) / 1023.0;\n if (offset > 1.0) offset -= 2048.0 / 1023.0;\n // by default, offset by the width and don't extend lines. Later,\n // calculate line extensions based on end cap and end join modes\n float yOffset = strokeWidth + antialiasing;\n if (vertex == 0
|
|
75970
|
+
module.exports = "/* lineFeature vertex shader */\n\n#ifdef GL_ES\n precision highp float;\n#endif\nattribute vec3 pos;\nattribute vec3 prev;\nattribute vec3 next;\nattribute vec3 far;\nattribute float flags;\n\nattribute vec3 strokeColor;\nattribute float strokeOpacity;\nattribute float strokeWidth;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float pixelWidth;\nuniform float aspect;\nuniform float miterLimit;\nuniform float antialiasing;\n\nvarying vec4 strokeColorVar;\nvarying vec4 subpos; /* px, py, length - px, width */\nvarying vec4 info; /* near mode, far mode, offset */\nvarying vec4 angles; /* near angle cos, sin, far angle cos, sin */\n\nconst float PI = 3.14159265358979323846264;\n\nvec4 viewCoord(vec3 c) {\n vec4 result = projectionMatrix * modelViewMatrix * vec4(c.xyz, 1.0);\n if (result.w != 0.0) result = result / result.w;\n return result;\n}\n\nfloat atan2(float y, float x) {\n if (x > 0.0) return atan(y / x);\n if (x < 0.0 && y >= 0.0) return atan(y / x) + PI;\n if (x < 0.0) return atan(y / x) - PI;\n return sign(y) * 0.5 * PI;\n}\n\nvoid main(void)\n{\n /* If any vertex has been deliberately set to a negative opacity,\n * skip doing computations on it. */\n if (strokeOpacity < 0.0) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n /* convert coordinates. We have four values, since we need to\n * calculate the angles between the lines formed by prev-pos and\n * pos-next, and between pos-next and next-far, plus know the angle\n * (prev)---(pos)---(next)---(far) => A---B---C---D */\n vec4 A = viewCoord(prev);\n vec4 B = viewCoord(pos);\n vec4 C = viewCoord(next);\n vec4 D = viewCoord(far);\n // calculate line segment vector and angle\n vec2 deltaCB = C.xy - B.xy;\n if (deltaCB == vec2(0.0, 0.0)) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n float lineLength = length(vec2(deltaCB.x, deltaCB.y / aspect)) / pixelWidth;\n // if lines reverse upon themselves and are not nearly the same length, skip\n // joins. This is a heuristic; the correct method would to be to pass some\n // sort of length of the adjacent line to the fragment renderer and adjust\n // which fragments are rendered, but this is much more complex.\n float abLimit = length(vec2(A.x - B.x, (A.y - B.y) / aspect)) / pixelWidth;\n float dcLimit = length(vec2(D.x - C.x, (D.y - C.y) / aspect)) / pixelWidth;\n if (abLimit >= lineLength - antialiasing - strokeWidth * 0.5 && abLimit <= lineLength + antialiasing + strokeWidth * 0.5) {\n abLimit = 0.0001;\n } else {\n if (abLimit < lineLength) abLimit = lineLength;\n abLimit = (strokeWidth - antialiasing) / (abLimit + antialiasing);\n if (abLimit < 0.0001) abLimit = 0.0001;\n if (abLimit > 0.1) abLimit = 0.1;\n }\n if (dcLimit >= lineLength - antialiasing - strokeWidth * 0.5 && dcLimit <= lineLength + antialiasing + strokeWidth * 0.5) {\n dcLimit = 0.0001;\n } else {\n if (dcLimit < lineLength) dcLimit = lineLength;\n dcLimit = (strokeWidth - antialiasing) / (dcLimit + antialiasing);\n if (dcLimit < 0.0001) dcLimit = 0.0001;\n if (dcLimit > 0.1) dcLimit = 0.1;\n }\n float angleCB = atan2(deltaCB.y, deltaCB.x * aspect);\n // values we need to pass along\n strokeColorVar = vec4(strokeColor, strokeOpacity);\n // extract values from our flags field\n int vertex = int(mod(flags, 4.0));\n int nearMode = int(mod(floor(flags / 4.0), 8.0));\n int farMode = int(mod(floor(flags / 32.0), 8.0));\n // we use 11 bits of the flags for the offset, where -1023 to 1023\n // maps to -1 to 1. The 11 bits are a signed value, so simply\n // selecting the bits will result in an unsigned values that may be\n // greater than 1, in which case we have to subtract appropriately.\n float offset = mod(floor(flags / 256.0), 2048.0) / 1023.0;\n if (offset > 1.0) offset -= 2048.0 / 1023.0;\n // by default, offset by the width and don't extend lines. Later,\n // calculate line extensions based on end cap and end join modes\n float yOffset = strokeWidth + antialiasing;\n if (vertex == 0) yOffset *= -1.0;\n yOffset += strokeWidth * offset;\n float xOffset = 0.0;\n // end caps\n if (nearMode == 0) {\n xOffset = antialiasing;\n } else if (nearMode == 1 || nearMode == 2) {\n xOffset = strokeWidth + antialiasing;\n }\n\n // If joining lines, calculate the angles in screen space formed by\n // the near end (A-B-C) and far end (B-C-D), and determine how much\n // space is needed for the particular join.\n // This could be changed: if the lines are not a uniform width and\n // offset, then the functional join angle is not simply half the\n // angle between the two lines, but rather half the angle of the\n // inside edge of the the two lines.\n float cosABC = 1.0, sinABC = 0.0, cosBCD = 1.0, sinBCD = 0.0; // of half angles\n // handle near end\n if (nearMode >= 4) {\n float angleBA = atan2(B.y - A.y, (B.x - A.x) * aspect);\n if (A.xy == B.xy) angleBA = angleCB;\n float angleABC = angleCB - angleBA;\n // ensure angle is in the range [-PI, PI], then take the half angle\n angleABC = (mod(angleABC + 3.0 * PI, 2.0 * PI) - PI) / 2.0;\n cosABC = cos(angleABC); sinABC = sin(angleABC);\n // if this angle is close to flat, pass-through the join\n if (nearMode >= 4 && (cosABC > 0.999999 || cosABC < abLimit)) {\n nearMode = 3;\n }\n // miter, miter-clip\n if (nearMode == 4 || nearMode == 7) {\n if (cosABC < 0.000001 || 1.0 / cosABC > miterLimit) {\n if (nearMode == 4) {\n nearMode = 5;\n } else {\n xOffset = miterLimit * strokeWidth * (1.0 - offset * sign(sinABC)) + antialiasing;\n }\n } else {\n // we add an extra 1.0 to the xOffset to make sure that fragment\n // shader is doing the clipping\n xOffset = abs(sinABC / cosABC) * strokeWidth * (1.0 - offset * sign(sinABC)) + antialiasing + 1.0;\n nearMode = 4;\n }\n }\n // bevel or round join\n if (nearMode == 5 || nearMode == 6) {\n xOffset = strokeWidth * (1.0 - offset * sign(sinABC)) + antialiasing;\n }\n }\n\n // handle far end\n if (farMode >= 4) {\n float angleDC = atan2(D.y - C.y, (D.x - C.x) * aspect);\n if (D.xy == C.xy) angleDC = angleCB;\n float angleBCD = angleDC - angleCB;\n // ensure angle is in the range [-PI, PI], then take the half angle\n angleBCD = (mod(angleBCD + 3.0 * PI, 2.0 * PI) - PI) / 2.0;\n cosBCD = cos(angleBCD); sinBCD = sin(angleBCD);\n // if this angle is close to flat, pass-through the join\n if (farMode >= 4 && (cosBCD > 0.999999 || cosBCD < dcLimit)) {\n farMode = 3;\n }\n // miter, miter-clip\n if (farMode == 4 || farMode == 7) {\n if (cosBCD < 0.000001 || 1.0 / cosBCD > miterLimit) {\n if (farMode == 4) farMode = 5;\n } else {\n farMode = 4;\n }\n }\n }\n\n // compute the location of a vertex to include everything that might\n // need to be rendered\n xOffset *= -1.0;\n gl_Position = vec4(\n B.x + (xOffset * cos(angleCB) - yOffset * sin(angleCB)) * pixelWidth,\n B.y + (xOffset * sin(angleCB) + yOffset * cos(angleCB)) * pixelWidth * aspect,\n B.z, 1.0);\n // store other values needed to determine which pixels to plot.\n if (vertex == 0 || vertex == 1) {\n subpos = vec4(xOffset, yOffset, lineLength - xOffset, strokeWidth);\n info = vec4(float(nearMode), float(farMode), offset, 0.0);\n angles = vec4(cosABC, sinABC, cosBCD, sinBCD);\n } else {\n subpos = vec4(lineLength - xOffset, -yOffset, xOffset, strokeWidth);\n info = vec4(float(farMode), float(nearMode), -offset, 0.0);\n angles = vec4(cosBCD, -sinBCD, cosABC, -sinABC);\n }\n}\n"
|
|
75933
75971
|
|
|
75934
75972
|
/***/ }),
|
|
75935
75973
|
|
package/geo.lean.js
CHANGED
|
@@ -15194,11 +15194,13 @@ var _map2 = function map(arg) {
|
|
|
15194
15194
|
* option when determining the new view.
|
|
15195
15195
|
* @param {boolean} [ignoreClampBounds] If `true`, ignore the clampBounds
|
|
15196
15196
|
* option when determining the new view.
|
|
15197
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan or zoom
|
|
15198
|
+
* event. If 'pan', only trigger the zoom event.
|
|
15197
15199
|
* @returns {number|this}
|
|
15198
15200
|
* @fires geo.event.zoom
|
|
15199
15201
|
* @fires geo.event.pan
|
|
15200
15202
|
*/
|
|
15201
|
-
this.zoom = function (val, origin, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
15203
|
+
this.zoom = function (val, origin, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
15202
15204
|
if (val === undefined) {
|
|
15203
15205
|
return m_zoom;
|
|
15204
15206
|
}
|
|
@@ -15223,22 +15225,52 @@ var _map2 = function map(arg) {
|
|
|
15223
15225
|
zoomLevel: m_zoom,
|
|
15224
15226
|
screenPosition: origin ? origin.map : undefined
|
|
15225
15227
|
};
|
|
15226
|
-
|
|
15228
|
+
if (!noTrigger || noTrigger === 'pan') {
|
|
15229
|
+
m_this.geoTrigger(geo_event.zoom, evt);
|
|
15230
|
+
}
|
|
15227
15231
|
if (aroundPoint) {
|
|
15228
15232
|
var shifted = m_this.gcsToDisplay(origin.mapgcs || origin.geo, origin.mapgcs ? null : undefined);
|
|
15229
15233
|
m_this.pan({
|
|
15230
15234
|
x: origin.map.x - shifted.x,
|
|
15231
15235
|
y: origin.map.y - shifted.y
|
|
15232
|
-
}, ignoreDiscreteZoom, true);
|
|
15236
|
+
}, ignoreDiscreteZoom, true, noTrigger);
|
|
15233
15237
|
} else {
|
|
15234
15238
|
m_this.pan({
|
|
15235
15239
|
x: 0,
|
|
15236
15240
|
y: 0
|
|
15237
|
-
}, ignoreDiscreteZoom, ignoreClampBounds);
|
|
15241
|
+
}, ignoreDiscreteZoom, ignoreClampBounds, noTrigger);
|
|
15238
15242
|
}
|
|
15239
15243
|
return m_this;
|
|
15240
15244
|
};
|
|
15241
15245
|
|
|
15246
|
+
/**
|
|
15247
|
+
* Set zoom level and center of the map.
|
|
15248
|
+
*
|
|
15249
|
+
* @param {number} zoom The new zoom level to set.
|
|
15250
|
+
* @param {geo.geoPosition} center The new center of the
|
|
15251
|
+
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
|
|
15252
|
+
* gcs, `null` to use the map gcs, or any other transform. The center is
|
|
15253
|
+
* converted from this gcs to the map projection.
|
|
15254
|
+
* @param {geo.geoPosition} origin.geo The gcs coordinates of the zoom
|
|
15255
|
+
* center.
|
|
15256
|
+
* @param {geo.screenPosition} origin.map The display coordinates of the zoom
|
|
15257
|
+
* center.
|
|
15258
|
+
* @param {boolean} [ignoreDiscreteZoom] If `true`, ignore the discreteZoom
|
|
15259
|
+
* option when determining the new view.
|
|
15260
|
+
* @param {boolean} [ignoreClampBounds] If `true`, ignore the clampBounds
|
|
15261
|
+
* option when determining the new view.
|
|
15262
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan or zoom
|
|
15263
|
+
* event.
|
|
15264
|
+
* @returns {this}
|
|
15265
|
+
* @fires geo.event.zoom
|
|
15266
|
+
* @fires geo.event.pan
|
|
15267
|
+
*/
|
|
15268
|
+
this.zoomAndCenter = function (zoom, center, gcs, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
15269
|
+
this.zoom(zoom, undefined, ignoreDiscreteZoom, ignoreClampBounds, noTrigger || 'pan');
|
|
15270
|
+
this.center(center, gcs, ignoreDiscreteZoom, ignoreClampBounds, noTrigger);
|
|
15271
|
+
return this;
|
|
15272
|
+
};
|
|
15273
|
+
|
|
15242
15274
|
/**
|
|
15243
15275
|
* Pan the map by a number of display pixels.
|
|
15244
15276
|
*
|
|
@@ -15252,10 +15284,11 @@ var _map2 = function map(arg) {
|
|
|
15252
15284
|
* view. When `'limited'`, the `clampBoundsX` and `clampBoundsY` options
|
|
15253
15285
|
* are selectively enforced so that the map will not end up more out of
|
|
15254
15286
|
* bounds than its current state.
|
|
15287
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan event.
|
|
15255
15288
|
* @returns {this}
|
|
15256
15289
|
* @fires geo.event.pan
|
|
15257
15290
|
*/
|
|
15258
|
-
this.pan = function (delta, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
15291
|
+
this.pan = function (delta, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
15259
15292
|
var evt = {
|
|
15260
15293
|
screenDelta: delta
|
|
15261
15294
|
};
|
|
@@ -15296,7 +15329,9 @@ var _map2 = function map(arg) {
|
|
|
15296
15329
|
x: m_width / 2,
|
|
15297
15330
|
y: m_height / 2
|
|
15298
15331
|
});
|
|
15299
|
-
|
|
15332
|
+
if (!noTrigger) {
|
|
15333
|
+
m_this.geoTrigger(geo_event.pan, evt);
|
|
15334
|
+
}
|
|
15300
15335
|
m_this.modified();
|
|
15301
15336
|
return m_this;
|
|
15302
15337
|
};
|
|
@@ -15358,7 +15393,7 @@ var _map2 = function map(arg) {
|
|
|
15358
15393
|
/**
|
|
15359
15394
|
* Get or set the center of the map in the given geographic coordinates.
|
|
15360
15395
|
*
|
|
15361
|
-
* @param {geo.geoPosition} coordinates If specified, the new center of the
|
|
15396
|
+
* @param {geo.geoPosition} [coordinates] If specified, the new center of the
|
|
15362
15397
|
* map.
|
|
15363
15398
|
* @param {string|geo.transform|null} [gcs] `undefined` to use the interface
|
|
15364
15399
|
* gcs, `null` to use the map gcs, or any other transform. If setting the
|
|
@@ -15371,10 +15406,11 @@ var _map2 = function map(arg) {
|
|
|
15371
15406
|
* view. When `'limited'`, the `clampBoundsX` and `clampBoundsY` options
|
|
15372
15407
|
* are selectively enforced so that the map will not end up more out of
|
|
15373
15408
|
* bounds than its current state.
|
|
15409
|
+
* @param {boolean} [noTrigger] If truthy, do not trigger a pan event.
|
|
15374
15410
|
* @returns {geo.geoPosition|this}
|
|
15375
15411
|
* @fires geo.event.pan
|
|
15376
15412
|
*/
|
|
15377
|
-
this.center = function (coordinates, gcs, ignoreDiscreteZoom, ignoreClampBounds) {
|
|
15413
|
+
this.center = function (coordinates, gcs, ignoreDiscreteZoom, ignoreClampBounds, noTrigger) {
|
|
15378
15414
|
var center;
|
|
15379
15415
|
if (coordinates === undefined) {
|
|
15380
15416
|
center = Object.assign({}, m_this.worldToGcs(m_center, gcs));
|
|
@@ -15386,12 +15422,14 @@ var _map2 = function map(arg) {
|
|
|
15386
15422
|
camera_bounds(m_this.boundsFromZoomAndCenter(m_zoom, center, m_rotation, null, ignoreDiscreteZoom, ignoreClampBounds), m_rotation);
|
|
15387
15423
|
m_this.modified();
|
|
15388
15424
|
// trigger a pan event
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15425
|
+
if (!noTrigger) {
|
|
15426
|
+
m_this.geoTrigger(geo_event.pan, {
|
|
15427
|
+
screenDelta: {
|
|
15428
|
+
x: 0,
|
|
15429
|
+
y: 0
|
|
15430
|
+
}
|
|
15431
|
+
});
|
|
15432
|
+
}
|
|
15395
15433
|
return m_this;
|
|
15396
15434
|
};
|
|
15397
15435
|
|
|
@@ -16150,7 +16188,7 @@ var _map2 = function map(arg) {
|
|
|
16150
16188
|
|
|
16151
16189
|
// This might have consequences in terms of bounds/zoom clamping.
|
|
16152
16190
|
// What behavior do we expect from this method in that case?
|
|
16153
|
-
m_this.zoom(nav.zoom);
|
|
16191
|
+
m_this.zoom(nav.zoom, undefined, undefined, undefined, 'pan');
|
|
16154
16192
|
m_this.center(nav.center, null);
|
|
16155
16193
|
}
|
|
16156
16194
|
return m_this.boundsFromZoomAndCenter(m_zoom, m_center, m_rotation, gcs, true);
|
|
@@ -25125,7 +25163,7 @@ module.exports = _sceneObject;
|
|
|
25125
25163
|
* @constant
|
|
25126
25164
|
* @type {string}
|
|
25127
25165
|
*/
|
|
25128
|
-
module.exports = "
|
|
25166
|
+
module.exports = "81c2c67b6f61c4292a790edab5e583c82095b099";
|
|
25129
25167
|
|
|
25130
25168
|
/***/ }),
|
|
25131
25169
|
|
|
@@ -37010,7 +37048,7 @@ module.exports = _vectorFeature;
|
|
|
37010
37048
|
* @constant
|
|
37011
37049
|
* @type {string}
|
|
37012
37050
|
*/
|
|
37013
|
-
module.exports = "1.
|
|
37051
|
+
module.exports = "1.14.1";
|
|
37014
37052
|
|
|
37015
37053
|
/***/ }),
|
|
37016
37054
|
|
|
@@ -72928,7 +72966,7 @@ module.exports = "/* lineFeature fragment shader */\n\n#ifdef GL_ES\n #ifdef GL
|
|
|
72928
72966
|
/***/ 9336:
|
|
72929
72967
|
/***/ (function(module) {
|
|
72930
72968
|
|
|
72931
|
-
module.exports = "/* lineFeature vertex shader */\n\n#ifdef GL_ES\n precision highp float;\n#endif\nattribute vec3 pos;\nattribute vec3 prev;\nattribute vec3 next;\nattribute vec3 far;\nattribute float flags;\n\nattribute vec3 strokeColor;\nattribute float strokeOpacity;\nattribute float strokeWidth;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float pixelWidth;\nuniform float aspect;\nuniform float miterLimit;\nuniform float antialiasing;\n\nvarying vec4 strokeColorVar;\nvarying vec4 subpos; /* px, py, length - px, width */\nvarying vec4 info; /* near mode, far mode, offset */\nvarying vec4 angles; /* near angle cos, sin, far angle cos, sin */\n\nconst float PI = 3.14159265358979323846264;\n\nvec4 viewCoord(vec3 c) {\n vec4 result = projectionMatrix * modelViewMatrix * vec4(c.xyz, 1.0);\n if (result.w != 0.0) result = result / result.w;\n return result;\n}\n\nfloat atan2(float y, float x) {\n if (x > 0.0) return atan(y / x);\n if (x < 0.0 && y >= 0.0) return atan(y / x) + PI;\n if (x < 0.0) return atan(y / x) - PI;\n return sign(y) * 0.5 * PI;\n}\n\nvoid main(void)\n{\n /* If any vertex has been deliberately set to a negative opacity,\n * skip doing computations on it. */\n if (strokeOpacity < 0.0) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n /* convert coordinates. We have four values, since we need to\n * calculate the angles between the lines formed by prev-pos and\n * pos-next, and between pos-next and next-far, plus know the angle\n * (prev)---(pos)---(next)---(far) => A---B---C---D */\n vec4 A = viewCoord(prev);\n vec4 B = viewCoord(pos);\n vec4 C = viewCoord(next);\n vec4 D = viewCoord(far);\n // calculate line segment vector and angle\n vec2 deltaCB = C.xy - B.xy;\n if (deltaCB == vec2(0.0, 0.0)) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n float angleCB = atan2(deltaCB.y, deltaCB.x * aspect);\n // values we need to pass along\n strokeColorVar = vec4(strokeColor, strokeOpacity);\n // extract values from our flags field\n int vertex = int(mod(flags, 4.0));\n int nearMode = int(mod(floor(flags / 4.0), 8.0));\n int farMode = int(mod(floor(flags / 32.0), 8.0));\n // we use 11 bits of the flags for the offset, where -1023 to 1023\n // maps to -1 to 1. The 11 bits are a signed value, so simply\n // selecting the bits will result in an unsigned values that may be\n // greater than 1, in which case we have to subtract appropriately.\n float offset = mod(floor(flags / 256.0), 2048.0) / 1023.0;\n if (offset > 1.0) offset -= 2048.0 / 1023.0;\n // by default, offset by the width and don't extend lines. Later,\n // calculate line extensions based on end cap and end join modes\n float yOffset = strokeWidth + antialiasing;\n if (vertex == 0
|
|
72969
|
+
module.exports = "/* lineFeature vertex shader */\n\n#ifdef GL_ES\n precision highp float;\n#endif\nattribute vec3 pos;\nattribute vec3 prev;\nattribute vec3 next;\nattribute vec3 far;\nattribute float flags;\n\nattribute vec3 strokeColor;\nattribute float strokeOpacity;\nattribute float strokeWidth;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float pixelWidth;\nuniform float aspect;\nuniform float miterLimit;\nuniform float antialiasing;\n\nvarying vec4 strokeColorVar;\nvarying vec4 subpos; /* px, py, length - px, width */\nvarying vec4 info; /* near mode, far mode, offset */\nvarying vec4 angles; /* near angle cos, sin, far angle cos, sin */\n\nconst float PI = 3.14159265358979323846264;\n\nvec4 viewCoord(vec3 c) {\n vec4 result = projectionMatrix * modelViewMatrix * vec4(c.xyz, 1.0);\n if (result.w != 0.0) result = result / result.w;\n return result;\n}\n\nfloat atan2(float y, float x) {\n if (x > 0.0) return atan(y / x);\n if (x < 0.0 && y >= 0.0) return atan(y / x) + PI;\n if (x < 0.0) return atan(y / x) - PI;\n return sign(y) * 0.5 * PI;\n}\n\nvoid main(void)\n{\n /* If any vertex has been deliberately set to a negative opacity,\n * skip doing computations on it. */\n if (strokeOpacity < 0.0) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n /* convert coordinates. We have four values, since we need to\n * calculate the angles between the lines formed by prev-pos and\n * pos-next, and between pos-next and next-far, plus know the angle\n * (prev)---(pos)---(next)---(far) => A---B---C---D */\n vec4 A = viewCoord(prev);\n vec4 B = viewCoord(pos);\n vec4 C = viewCoord(next);\n vec4 D = viewCoord(far);\n // calculate line segment vector and angle\n vec2 deltaCB = C.xy - B.xy;\n if (deltaCB == vec2(0.0, 0.0)) {\n gl_Position = vec4(2.0, 2.0, 0.0, 1.0);\n return;\n }\n float lineLength = length(vec2(deltaCB.x, deltaCB.y / aspect)) / pixelWidth;\n // if lines reverse upon themselves and are not nearly the same length, skip\n // joins. This is a heuristic; the correct method would to be to pass some\n // sort of length of the adjacent line to the fragment renderer and adjust\n // which fragments are rendered, but this is much more complex.\n float abLimit = length(vec2(A.x - B.x, (A.y - B.y) / aspect)) / pixelWidth;\n float dcLimit = length(vec2(D.x - C.x, (D.y - C.y) / aspect)) / pixelWidth;\n if (abLimit >= lineLength - antialiasing - strokeWidth * 0.5 && abLimit <= lineLength + antialiasing + strokeWidth * 0.5) {\n abLimit = 0.0001;\n } else {\n if (abLimit < lineLength) abLimit = lineLength;\n abLimit = (strokeWidth - antialiasing) / (abLimit + antialiasing);\n if (abLimit < 0.0001) abLimit = 0.0001;\n if (abLimit > 0.1) abLimit = 0.1;\n }\n if (dcLimit >= lineLength - antialiasing - strokeWidth * 0.5 && dcLimit <= lineLength + antialiasing + strokeWidth * 0.5) {\n dcLimit = 0.0001;\n } else {\n if (dcLimit < lineLength) dcLimit = lineLength;\n dcLimit = (strokeWidth - antialiasing) / (dcLimit + antialiasing);\n if (dcLimit < 0.0001) dcLimit = 0.0001;\n if (dcLimit > 0.1) dcLimit = 0.1;\n }\n float angleCB = atan2(deltaCB.y, deltaCB.x * aspect);\n // values we need to pass along\n strokeColorVar = vec4(strokeColor, strokeOpacity);\n // extract values from our flags field\n int vertex = int(mod(flags, 4.0));\n int nearMode = int(mod(floor(flags / 4.0), 8.0));\n int farMode = int(mod(floor(flags / 32.0), 8.0));\n // we use 11 bits of the flags for the offset, where -1023 to 1023\n // maps to -1 to 1. The 11 bits are a signed value, so simply\n // selecting the bits will result in an unsigned values that may be\n // greater than 1, in which case we have to subtract appropriately.\n float offset = mod(floor(flags / 256.0), 2048.0) / 1023.0;\n if (offset > 1.0) offset -= 2048.0 / 1023.0;\n // by default, offset by the width and don't extend lines. Later,\n // calculate line extensions based on end cap and end join modes\n float yOffset = strokeWidth + antialiasing;\n if (vertex == 0) yOffset *= -1.0;\n yOffset += strokeWidth * offset;\n float xOffset = 0.0;\n // end caps\n if (nearMode == 0) {\n xOffset = antialiasing;\n } else if (nearMode == 1 || nearMode == 2) {\n xOffset = strokeWidth + antialiasing;\n }\n\n // If joining lines, calculate the angles in screen space formed by\n // the near end (A-B-C) and far end (B-C-D), and determine how much\n // space is needed for the particular join.\n // This could be changed: if the lines are not a uniform width and\n // offset, then the functional join angle is not simply half the\n // angle between the two lines, but rather half the angle of the\n // inside edge of the the two lines.\n float cosABC = 1.0, sinABC = 0.0, cosBCD = 1.0, sinBCD = 0.0; // of half angles\n // handle near end\n if (nearMode >= 4) {\n float angleBA = atan2(B.y - A.y, (B.x - A.x) * aspect);\n if (A.xy == B.xy) angleBA = angleCB;\n float angleABC = angleCB - angleBA;\n // ensure angle is in the range [-PI, PI], then take the half angle\n angleABC = (mod(angleABC + 3.0 * PI, 2.0 * PI) - PI) / 2.0;\n cosABC = cos(angleABC); sinABC = sin(angleABC);\n // if this angle is close to flat, pass-through the join\n if (nearMode >= 4 && (cosABC > 0.999999 || cosABC < abLimit)) {\n nearMode = 3;\n }\n // miter, miter-clip\n if (nearMode == 4 || nearMode == 7) {\n if (cosABC < 0.000001 || 1.0 / cosABC > miterLimit) {\n if (nearMode == 4) {\n nearMode = 5;\n } else {\n xOffset = miterLimit * strokeWidth * (1.0 - offset * sign(sinABC)) + antialiasing;\n }\n } else {\n // we add an extra 1.0 to the xOffset to make sure that fragment\n // shader is doing the clipping\n xOffset = abs(sinABC / cosABC) * strokeWidth * (1.0 - offset * sign(sinABC)) + antialiasing + 1.0;\n nearMode = 4;\n }\n }\n // bevel or round join\n if (nearMode == 5 || nearMode == 6) {\n xOffset = strokeWidth * (1.0 - offset * sign(sinABC)) + antialiasing;\n }\n }\n\n // handle far end\n if (farMode >= 4) {\n float angleDC = atan2(D.y - C.y, (D.x - C.x) * aspect);\n if (D.xy == C.xy) angleDC = angleCB;\n float angleBCD = angleDC - angleCB;\n // ensure angle is in the range [-PI, PI], then take the half angle\n angleBCD = (mod(angleBCD + 3.0 * PI, 2.0 * PI) - PI) / 2.0;\n cosBCD = cos(angleBCD); sinBCD = sin(angleBCD);\n // if this angle is close to flat, pass-through the join\n if (farMode >= 4 && (cosBCD > 0.999999 || cosBCD < dcLimit)) {\n farMode = 3;\n }\n // miter, miter-clip\n if (farMode == 4 || farMode == 7) {\n if (cosBCD < 0.000001 || 1.0 / cosBCD > miterLimit) {\n if (farMode == 4) farMode = 5;\n } else {\n farMode = 4;\n }\n }\n }\n\n // compute the location of a vertex to include everything that might\n // need to be rendered\n xOffset *= -1.0;\n gl_Position = vec4(\n B.x + (xOffset * cos(angleCB) - yOffset * sin(angleCB)) * pixelWidth,\n B.y + (xOffset * sin(angleCB) + yOffset * cos(angleCB)) * pixelWidth * aspect,\n B.z, 1.0);\n // store other values needed to determine which pixels to plot.\n if (vertex == 0 || vertex == 1) {\n subpos = vec4(xOffset, yOffset, lineLength - xOffset, strokeWidth);\n info = vec4(float(nearMode), float(farMode), offset, 0.0);\n angles = vec4(cosABC, sinABC, cosBCD, sinBCD);\n } else {\n subpos = vec4(lineLength - xOffset, -yOffset, xOffset, strokeWidth);\n info = vec4(float(farMode), float(nearMode), -offset, 0.0);\n angles = vec4(cosBCD, -sinBCD, cosABC, -sinABC);\n }\n}\n"
|
|
72932
72970
|
|
|
72933
72971
|
/***/ }),
|
|
72934
72972
|
|