@nextgis/ngw-map 1.18.0 → 1.18.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/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.esm-browser.js +39 -12
- 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 +42 -12
- 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 +6 -6
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.1; author: NextGIS */
|
|
2
2
|
var events = {exports: {}};
|
|
3
3
|
|
|
4
4
|
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
@@ -1947,32 +1947,43 @@ function createPropertiesPaint(propertiesPaint) {
|
|
|
1947
1947
|
return mask;
|
|
1948
1948
|
};
|
|
1949
1949
|
}
|
|
1950
|
-
function expressionCallback(paint, defaultPaint,
|
|
1950
|
+
function expressionCallback({ paint, defaultPaint, }) {
|
|
1951
1951
|
const expressionCallback = createExpressionCallback(paint);
|
|
1952
1952
|
if (expressionCallback) {
|
|
1953
1953
|
const expressionPaintCb = (feature) => {
|
|
1954
|
-
return preparePaint(
|
|
1954
|
+
return preparePaint({
|
|
1955
|
+
paint: expressionCallback(feature),
|
|
1956
|
+
defaultPaint,
|
|
1957
|
+
});
|
|
1955
1958
|
};
|
|
1956
|
-
expressionPaintCb.paint = paint;
|
|
1959
|
+
expressionPaintCb.paint = finalizePaint({ paint, defaultPaint });
|
|
1957
1960
|
return expressionPaintCb;
|
|
1958
1961
|
}
|
|
1962
|
+
return finalizePaint({ paint, defaultPaint });
|
|
1963
|
+
}
|
|
1964
|
+
function finalizePaint({ paint, defaultPaint }) {
|
|
1965
|
+
var _a;
|
|
1959
1966
|
let newPaint = { ...defaultPaint };
|
|
1960
1967
|
newPaint = { ...newPaint, ...paint };
|
|
1961
|
-
newPaint.fill = newPaint.fill !==
|
|
1968
|
+
newPaint.fill = (_a = newPaint.fill) !== null && _a !== void 0 ? _a : true;
|
|
1962
1969
|
newPaint.stroke =
|
|
1963
1970
|
newPaint.stroke !== undefined
|
|
1964
1971
|
? newPaint.stroke
|
|
1965
1972
|
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
1966
1973
|
return newPaint;
|
|
1967
1974
|
}
|
|
1968
|
-
function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
1975
|
+
function preparePaint({ paint, defaultPaint, getPaintFunctions, }) {
|
|
1969
1976
|
if (!paint) {
|
|
1970
1977
|
throw new Error('paint is empty');
|
|
1971
1978
|
}
|
|
1972
1979
|
let newPaint = { ...defaultPaint };
|
|
1973
1980
|
if (isPaintCallback(paint)) {
|
|
1974
1981
|
const getPaintFunction = (feature) => {
|
|
1975
|
-
const getPaint = preparePaint(
|
|
1982
|
+
const getPaint = preparePaint({
|
|
1983
|
+
paint: paint(feature),
|
|
1984
|
+
defaultPaint,
|
|
1985
|
+
getPaintFunctions,
|
|
1986
|
+
});
|
|
1976
1987
|
getPaint.type = paint.type;
|
|
1977
1988
|
return getPaint;
|
|
1978
1989
|
};
|
|
@@ -1981,20 +1992,28 @@ function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
|
1981
1992
|
}
|
|
1982
1993
|
else if (isPropertiesPaint(paint)) {
|
|
1983
1994
|
return (feature) => {
|
|
1984
|
-
return preparePaint(
|
|
1995
|
+
return preparePaint({
|
|
1996
|
+
paint: createPropertiesPaint(paint)(feature),
|
|
1997
|
+
defaultPaint,
|
|
1998
|
+
getPaintFunctions,
|
|
1999
|
+
});
|
|
1985
2000
|
};
|
|
1986
2001
|
}
|
|
1987
2002
|
else if (paint.type === 'get-paint') {
|
|
1988
2003
|
const getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
|
|
1989
2004
|
if (getPaint) {
|
|
1990
|
-
newPaint = preparePaint(
|
|
2005
|
+
newPaint = preparePaint({
|
|
2006
|
+
paint: getPaint,
|
|
2007
|
+
defaultPaint,
|
|
2008
|
+
getPaintFunctions,
|
|
2009
|
+
});
|
|
1991
2010
|
}
|
|
1992
2011
|
}
|
|
1993
2012
|
else if (paint.type === 'icon') {
|
|
1994
2013
|
return paint;
|
|
1995
2014
|
}
|
|
1996
2015
|
else {
|
|
1997
|
-
newPaint = expressionCallback(paint, defaultPaint
|
|
2016
|
+
newPaint = expressionCallback({ paint, defaultPaint });
|
|
1998
2017
|
}
|
|
1999
2018
|
if (isPaintCallback(newPaint)) {
|
|
2000
2019
|
return newPaint;
|
|
@@ -3602,10 +3621,18 @@ class WebMapLayers extends WebMapMain {
|
|
|
3602
3621
|
};
|
|
3603
3622
|
if (!options.nativePaint) {
|
|
3604
3623
|
if (this.options.paint) {
|
|
3605
|
-
options.paint = preparePaint(
|
|
3624
|
+
options.paint = preparePaint({
|
|
3625
|
+
paint: options.paint || {},
|
|
3626
|
+
defaultPaint: this.options.paint,
|
|
3627
|
+
getPaintFunctions: this.getPaintFunctions,
|
|
3628
|
+
});
|
|
3606
3629
|
}
|
|
3607
3630
|
if (options.selectedPaint && this.options.selectedPaint) {
|
|
3608
|
-
options.selectedPaint = preparePaint(
|
|
3631
|
+
options.selectedPaint = preparePaint({
|
|
3632
|
+
paint: options.selectedPaint,
|
|
3633
|
+
defaultPaint: this.options.selectedPaint,
|
|
3634
|
+
getPaintFunctions: this.getPaintFunctions,
|
|
3635
|
+
});
|
|
3609
3636
|
}
|
|
3610
3637
|
}
|
|
3611
3638
|
}
|