@nextgis/ngw-map 1.18.3 → 1.18.6
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/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.esm-browser.js +31 -20
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +1 -1
- package/lib/ngw-map.global.js +32 -21
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +7 -7
package/lib/ngw-map.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.18.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.18.6; author: NextGIS */
|
|
2
2
|
var events = {exports: {}};
|
|
3
3
|
|
|
4
4
|
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
@@ -4979,8 +4979,9 @@ class NgwConnector$1 {
|
|
|
4979
4979
|
* ```
|
|
4980
4980
|
*/
|
|
4981
4981
|
apiRequest(name, params_ = {}, requestOptions = {}) {
|
|
4982
|
-
var _a;
|
|
4982
|
+
var _a, _b;
|
|
4983
4983
|
const { method, headers, withCredentials, responseType } = requestOptions;
|
|
4984
|
+
params_ = (_a = requestOptions.params) !== null && _a !== void 0 ? _a : params_;
|
|
4984
4985
|
const params = objectRemoveEmpty(params_);
|
|
4985
4986
|
const makeApiRequest = () => apiRequest({ name, params, requestOptions, connector: this });
|
|
4986
4987
|
if (requestOptions.cache && method === 'GET') {
|
|
@@ -4992,7 +4993,7 @@ class NgwConnector$1 {
|
|
|
4992
4993
|
withCredentials,
|
|
4993
4994
|
responseType,
|
|
4994
4995
|
baseUrl: this.options.baseUrl,
|
|
4995
|
-
userId: (
|
|
4996
|
+
userId: (_b = this.user) === null || _b === void 0 ? void 0 : _b.id,
|
|
4996
4997
|
}),
|
|
4997
4998
|
});
|
|
4998
4999
|
}
|
|
@@ -8051,15 +8052,16 @@ const svgPath = {
|
|
|
8051
8052
|
minus: '<path d="m12 7.5v-3h-12v3z"/>',
|
|
8052
8053
|
asterisk: '<path d="m7.59 12v-3.27l2.83 1.64 1.58-2.74-2.85-1.64 2.83-1.64-1.56-2.74-2.83 1.64v-3.24h-3.17v3.24l-2.85-1.64-1.57 2.74 2.84 1.64-2.84 1.64 1.57 2.74 2.85-1.64v3.27z"/>',
|
|
8053
8054
|
};
|
|
8055
|
+
const VIEW_BOX = 12;
|
|
8054
8056
|
const STROKE = 0.8;
|
|
8055
|
-
function generateSvg(width, height, stroke = 0, content) {
|
|
8057
|
+
function generateSvg({ width, height, stroke = 0, content, }) {
|
|
8056
8058
|
const s = stroke / 2;
|
|
8057
8059
|
const svg = `<svg
|
|
8058
8060
|
version="1.1"
|
|
8059
8061
|
xmlns="http://www.w3.org/2000/svg"
|
|
8060
8062
|
width="${width}"
|
|
8061
8063
|
height="${height}"
|
|
8062
|
-
viewBox="-${s} -${s} ${
|
|
8064
|
+
viewBox="-${s} -${s} ${VIEW_BOX + stroke} ${VIEW_BOX + stroke}"
|
|
8063
8065
|
>${content}</svg>`;
|
|
8064
8066
|
return svg;
|
|
8065
8067
|
}
|
|
@@ -8068,36 +8070,45 @@ function insertSvg(svg) {
|
|
|
8068
8070
|
const oDOM = oParser.parseFromString(svg, 'image/svg+xml');
|
|
8069
8071
|
return oDOM.documentElement;
|
|
8070
8072
|
}
|
|
8073
|
+
/**
|
|
8074
|
+
* Retrieves an icon with the provided options.
|
|
8075
|
+
* @function
|
|
8076
|
+
* @param {IconOptions} [opt={}] - Options for the icon.
|
|
8077
|
+
* @returns {IconPaint} Icon paint object.
|
|
8078
|
+
*/
|
|
8071
8079
|
function getIcon(opt = {}) {
|
|
8072
|
-
var _a, _b, _c, _d, _e;
|
|
8073
|
-
//
|
|
8080
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8081
|
+
// Default values
|
|
8074
8082
|
const shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
|
|
8075
8083
|
const color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
|
|
8076
8084
|
const strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
|
|
8077
|
-
const size = (_d = opt.size) !== null && _d !== void 0 ? _d :
|
|
8085
|
+
const size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
|
|
8078
8086
|
const rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
|
|
8079
|
-
const anchor = size / 2;
|
|
8080
|
-
const defSize = 12;
|
|
8087
|
+
const anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
|
|
8081
8088
|
const stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
|
|
8082
|
-
const scale = size / defSize;
|
|
8083
8089
|
const pathAlias = opt.p || svgPath[shape] || 'circle';
|
|
8084
8090
|
const path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
|
|
8085
|
-
const svg = insertSvg(opt.svg ||
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8091
|
+
const svg = insertSvg(opt.svg ||
|
|
8092
|
+
generateSvg({
|
|
8093
|
+
width: size,
|
|
8094
|
+
height: size,
|
|
8095
|
+
stroke,
|
|
8096
|
+
content: path,
|
|
8097
|
+
}));
|
|
8098
|
+
svg.setAttribute('width', String(size));
|
|
8099
|
+
svg.setAttribute('height', String(size));
|
|
8100
|
+
svg.setAttribute('fill', color);
|
|
8090
8101
|
if (stroke) {
|
|
8091
|
-
|
|
8092
|
-
|
|
8102
|
+
svg.setAttribute('stroke', strokeColor);
|
|
8103
|
+
svg.setAttribute('stroke-width', String(stroke));
|
|
8093
8104
|
}
|
|
8094
|
-
fistChild.setAttribute('transform', transform);
|
|
8095
8105
|
const s = new XMLSerializer();
|
|
8096
8106
|
return {
|
|
8097
8107
|
type: 'icon',
|
|
8098
8108
|
iconSize: [size, size],
|
|
8099
|
-
iconAnchor:
|
|
8109
|
+
iconAnchor: anchor,
|
|
8100
8110
|
html: s.serializeToString(svg),
|
|
8111
|
+
rotate,
|
|
8101
8112
|
svg,
|
|
8102
8113
|
};
|
|
8103
8114
|
}
|