@emuanalytics/flow-rdf-core 4.1.5 → 4.1.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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/lib/map/flow-core-map.mjs +34 -15
- package/dist/lib/map/plugins/index.d.mts +2 -2
- package/dist/lib/map/plugins/index.d.ts +2 -2
- package/dist/lib/map/support/map-events.mjs +3 -2
- package/dist/lib/map/support/sort-features-by-draw-order.mjs +49 -0
- package/dist/package.json.mjs +1 -1
- package/dist/shared/{flow-rdf-core.09a21889.d.mts → flow-rdf-core.dcf0da97.d.mts} +16 -9
- package/dist/shared/{flow-rdf-core.09a21889.d.ts → flow-rdf-core.dcf0da97.d.ts} +16 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Annotation, M as MapStyleSpecification, S as StateStore, a as MapDataSource, b as MapLayer, F as FlowContextOptions, c as FlowContext } from './shared/flow-rdf-core.
|
|
2
|
-
export { B as BackgroundLayerStyleBuilder, C as CircleLayerStyleBuilder, D as DEFAULT_CONTEXT_ID, _ as FeatureStreamOptions, s as FillExtrusionLayerStyleBuilder, q as FillLayerStyleBuilder, d as FlowCoreError, h as FlowCoreExpressionCustomFunction, i as FlowCoreExpressionCustomFunctionSignature, j as FlowCoreExpressionCustomFunctions, e as FlowCoreExpressionError, a0 as FlowCoreMap, o as FlowEngineEndpoint, f as FlowMapError, H as HeatmapLayerStyleBuilder, u as HillshadeLayerStyleBuilder, L as LineLayerStyleBuilder, T as MapAnimationOptions, U as MapCenterOptions, K as MapDataSourceOptions, N as MapDataSourceSpecification, J as MapDataSourceType, a3 as MapEvent, a2 as MapEventType, a1 as MapEventTypes, V as MapFeature, W as MapFeatureIdentifier, Z as MapFeatureStream, O as MapGeojsonData, E as MapLayerExpression, z as MapLayerOptions, I as MapLayerPropertyMetadataIndex, G as MapLayerSpecification, w as MapLayerStyleBuilder, p as MapLayerType, a6 as MapLoadingEvent, a4 as MapMouseEvent, $ as MapOptions, X as MapPaddingOptions, aa as MapPopup, a9 as MapPopupOptions, a8 as MapPopupTemplateFn, g as MapRegistry, a5 as MapSourceEvent, Y as MapSourceIdentifier, a7 as MapStyleChangeEvent, P as ParserExpression, k as ParserExpressionWithIndex, l as ParserFunctionExpression, m as ParserIndex, n as ParserProgram, aq as Path, ar as PathValue, ab as Query, ag as QueryAttribute, al as QueryDefinition, an as QueryDefinitionFn, ai as QueryExtraParams, am as QueryOptions, aj as QueryOrderClause, Q as QueryRegistry, af as QueryResultFormat, ao as QueryResultTransformFn, ak as QuerySampleOptions, ah as QueryWhereClauses, t as RasterLayerStyleBuilder, R as ReactiveExpression, au as SerializationFormat, at as StoreAnnotations, as as StoreConstructor, x as StyleExpression, r as SymbolLayerStyleBuilder, y as expr, v as layerStyle, ac as query, ad as queryMany, ae as queryOne, ap as traceReaction } from './shared/flow-rdf-core.
|
|
1
|
+
import { A as Annotation, M as MapStyleSpecification, S as StateStore, a as MapDataSource, b as MapLayer, F as FlowContextOptions, c as FlowContext } from './shared/flow-rdf-core.dcf0da97.mjs';
|
|
2
|
+
export { B as BackgroundLayerStyleBuilder, C as CircleLayerStyleBuilder, D as DEFAULT_CONTEXT_ID, _ as FeatureStreamOptions, s as FillExtrusionLayerStyleBuilder, q as FillLayerStyleBuilder, d as FlowCoreError, h as FlowCoreExpressionCustomFunction, i as FlowCoreExpressionCustomFunctionSignature, j as FlowCoreExpressionCustomFunctions, e as FlowCoreExpressionError, a0 as FlowCoreMap, o as FlowEngineEndpoint, f as FlowMapError, H as HeatmapLayerStyleBuilder, u as HillshadeLayerStyleBuilder, L as LineLayerStyleBuilder, T as MapAnimationOptions, U as MapCenterOptions, K as MapDataSourceOptions, N as MapDataSourceSpecification, J as MapDataSourceType, a3 as MapEvent, a2 as MapEventType, a1 as MapEventTypes, V as MapFeature, W as MapFeatureIdentifier, Z as MapFeatureStream, O as MapGeojsonData, E as MapLayerExpression, z as MapLayerOptions, I as MapLayerPropertyMetadataIndex, G as MapLayerSpecification, w as MapLayerStyleBuilder, p as MapLayerType, a6 as MapLoadingEvent, a4 as MapMouseEvent, $ as MapOptions, X as MapPaddingOptions, aa as MapPopup, a9 as MapPopupOptions, a8 as MapPopupTemplateFn, g as MapRegistry, a5 as MapSourceEvent, Y as MapSourceIdentifier, a7 as MapStyleChangeEvent, P as ParserExpression, k as ParserExpressionWithIndex, l as ParserFunctionExpression, m as ParserIndex, n as ParserProgram, aq as Path, ar as PathValue, ab as Query, ag as QueryAttribute, al as QueryDefinition, an as QueryDefinitionFn, ai as QueryExtraParams, am as QueryOptions, aj as QueryOrderClause, Q as QueryRegistry, af as QueryResultFormat, ao as QueryResultTransformFn, ak as QuerySampleOptions, ah as QueryWhereClauses, t as RasterLayerStyleBuilder, R as ReactiveExpression, au as SerializationFormat, at as StoreAnnotations, as as StoreConstructor, x as StyleExpression, r as SymbolLayerStyleBuilder, y as expr, v as layerStyle, ac as query, ad as queryMany, ae as queryOne, ap as traceReaction } from './shared/flow-rdf-core.dcf0da97.mjs';
|
|
3
3
|
export { IDisposer, IObservableStream, ISubscription } from 'mobx-utils';
|
|
4
4
|
export { makeAutoObservable, makeObservable } from 'mobx';
|
|
5
5
|
import 'eventemitter3';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Annotation, M as MapStyleSpecification, S as StateStore, a as MapDataSource, b as MapLayer, F as FlowContextOptions, c as FlowContext } from './shared/flow-rdf-core.
|
|
2
|
-
export { B as BackgroundLayerStyleBuilder, C as CircleLayerStyleBuilder, D as DEFAULT_CONTEXT_ID, _ as FeatureStreamOptions, s as FillExtrusionLayerStyleBuilder, q as FillLayerStyleBuilder, d as FlowCoreError, h as FlowCoreExpressionCustomFunction, i as FlowCoreExpressionCustomFunctionSignature, j as FlowCoreExpressionCustomFunctions, e as FlowCoreExpressionError, a0 as FlowCoreMap, o as FlowEngineEndpoint, f as FlowMapError, H as HeatmapLayerStyleBuilder, u as HillshadeLayerStyleBuilder, L as LineLayerStyleBuilder, T as MapAnimationOptions, U as MapCenterOptions, K as MapDataSourceOptions, N as MapDataSourceSpecification, J as MapDataSourceType, a3 as MapEvent, a2 as MapEventType, a1 as MapEventTypes, V as MapFeature, W as MapFeatureIdentifier, Z as MapFeatureStream, O as MapGeojsonData, E as MapLayerExpression, z as MapLayerOptions, I as MapLayerPropertyMetadataIndex, G as MapLayerSpecification, w as MapLayerStyleBuilder, p as MapLayerType, a6 as MapLoadingEvent, a4 as MapMouseEvent, $ as MapOptions, X as MapPaddingOptions, aa as MapPopup, a9 as MapPopupOptions, a8 as MapPopupTemplateFn, g as MapRegistry, a5 as MapSourceEvent, Y as MapSourceIdentifier, a7 as MapStyleChangeEvent, P as ParserExpression, k as ParserExpressionWithIndex, l as ParserFunctionExpression, m as ParserIndex, n as ParserProgram, aq as Path, ar as PathValue, ab as Query, ag as QueryAttribute, al as QueryDefinition, an as QueryDefinitionFn, ai as QueryExtraParams, am as QueryOptions, aj as QueryOrderClause, Q as QueryRegistry, af as QueryResultFormat, ao as QueryResultTransformFn, ak as QuerySampleOptions, ah as QueryWhereClauses, t as RasterLayerStyleBuilder, R as ReactiveExpression, au as SerializationFormat, at as StoreAnnotations, as as StoreConstructor, x as StyleExpression, r as SymbolLayerStyleBuilder, y as expr, v as layerStyle, ac as query, ad as queryMany, ae as queryOne, ap as traceReaction } from './shared/flow-rdf-core.
|
|
1
|
+
import { A as Annotation, M as MapStyleSpecification, S as StateStore, a as MapDataSource, b as MapLayer, F as FlowContextOptions, c as FlowContext } from './shared/flow-rdf-core.dcf0da97.js';
|
|
2
|
+
export { B as BackgroundLayerStyleBuilder, C as CircleLayerStyleBuilder, D as DEFAULT_CONTEXT_ID, _ as FeatureStreamOptions, s as FillExtrusionLayerStyleBuilder, q as FillLayerStyleBuilder, d as FlowCoreError, h as FlowCoreExpressionCustomFunction, i as FlowCoreExpressionCustomFunctionSignature, j as FlowCoreExpressionCustomFunctions, e as FlowCoreExpressionError, a0 as FlowCoreMap, o as FlowEngineEndpoint, f as FlowMapError, H as HeatmapLayerStyleBuilder, u as HillshadeLayerStyleBuilder, L as LineLayerStyleBuilder, T as MapAnimationOptions, U as MapCenterOptions, K as MapDataSourceOptions, N as MapDataSourceSpecification, J as MapDataSourceType, a3 as MapEvent, a2 as MapEventType, a1 as MapEventTypes, V as MapFeature, W as MapFeatureIdentifier, Z as MapFeatureStream, O as MapGeojsonData, E as MapLayerExpression, z as MapLayerOptions, I as MapLayerPropertyMetadataIndex, G as MapLayerSpecification, w as MapLayerStyleBuilder, p as MapLayerType, a6 as MapLoadingEvent, a4 as MapMouseEvent, $ as MapOptions, X as MapPaddingOptions, aa as MapPopup, a9 as MapPopupOptions, a8 as MapPopupTemplateFn, g as MapRegistry, a5 as MapSourceEvent, Y as MapSourceIdentifier, a7 as MapStyleChangeEvent, P as ParserExpression, k as ParserExpressionWithIndex, l as ParserFunctionExpression, m as ParserIndex, n as ParserProgram, aq as Path, ar as PathValue, ab as Query, ag as QueryAttribute, al as QueryDefinition, an as QueryDefinitionFn, ai as QueryExtraParams, am as QueryOptions, aj as QueryOrderClause, Q as QueryRegistry, af as QueryResultFormat, ao as QueryResultTransformFn, ak as QuerySampleOptions, ah as QueryWhereClauses, t as RasterLayerStyleBuilder, R as ReactiveExpression, au as SerializationFormat, at as StoreAnnotations, as as StoreConstructor, x as StyleExpression, r as SymbolLayerStyleBuilder, y as expr, v as layerStyle, ac as query, ad as queryMany, ae as queryOne, ap as traceReaction } from './shared/flow-rdf-core.dcf0da97.js';
|
|
3
3
|
export { IDisposer, IObservableStream, ISubscription } from 'mobx-utils';
|
|
4
4
|
export { makeAutoObservable, makeObservable } from 'mobx';
|
|
5
5
|
import 'eventemitter3';
|
|
@@ -13,6 +13,7 @@ import { PluginManager } from './plugins/plugin-manager.mjs';
|
|
|
13
13
|
import { ImageRegistry } from './support/image-registry.mjs';
|
|
14
14
|
import { MapStyleChangeEvent, MapSourceEvent, MapEvent, MapLoadingEvent, MapMouseEvent } from './support/map-events.mjs';
|
|
15
15
|
import { MapFeatureStream } from './support/map-feature-stream.mjs';
|
|
16
|
+
import { sortFeaturesByDrawOrder } from './support/sort-features-by-draw-order.mjs';
|
|
16
17
|
import { MapStyle } from '../map-style/map-style.mjs';
|
|
17
18
|
import { MapLayer } from '../map-style/map-layer.mjs';
|
|
18
19
|
import { MapDataSource } from '../map-style/map-data-source.mjs';
|
|
@@ -315,8 +316,8 @@ const _FlowCoreMap = class _FlowCoreMap extends EventEmitter {
|
|
|
315
316
|
/**
|
|
316
317
|
* Register a map icon image.
|
|
317
318
|
*
|
|
318
|
-
* The image can be used on [symbol-type map layers](/flow-rdf-core/layer-reference/symbol) by specifying
|
|
319
|
-
* as the [`iconImage`](/flow-rdf-core/layer-reference/symbol#icon-image) property.
|
|
319
|
+
* The image can be used on [symbol-type map layers](/flow-rdf/flow-rdf-core/layer-reference/symbol) by specifying
|
|
320
|
+
* the image ID as the [`iconImage`](/flow-rdf/flow-rdf-core/layer-reference/symbol#icon-image) property.
|
|
320
321
|
*
|
|
321
322
|
* :::warning
|
|
322
323
|
* To fully support recoloring and halo effects, the source image should be a SDF (signed distance field) image.
|
|
@@ -517,10 +518,11 @@ const _FlowCoreMap = class _FlowCoreMap extends EventEmitter {
|
|
|
517
518
|
/**
|
|
518
519
|
* Returns the map's current visible bounds in degrees as an array of `[west, south, east, north]`.
|
|
519
520
|
*
|
|
520
|
-
* The visible bounds
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
521
|
+
* The visible bounds are the bounds of the part of the map's canvas that lies within the parent element of the
|
|
522
|
+
* map's container (the `flow-ui-map` element). They differ from the map's full bounds when the `fixed` mode of
|
|
523
|
+
* `flow-ui-map` is used. In that mode, the canvas fills the viewport and is clipped to the `flow-ui-map` element,
|
|
524
|
+
* so that side bars can be opened and closed without re-rendering the map. Otherwise the canvas fills the element,
|
|
525
|
+
* and the visible bounds are the full bounds.
|
|
524
526
|
*
|
|
525
527
|
* See also {@link getBounds}.
|
|
526
528
|
*/
|
|
@@ -529,11 +531,21 @@ const _FlowCoreMap = class _FlowCoreMap extends EventEmitter {
|
|
|
529
531
|
if (!parentEl) {
|
|
530
532
|
return this.getBounds();
|
|
531
533
|
}
|
|
532
|
-
const
|
|
533
|
-
const
|
|
534
|
-
const
|
|
535
|
-
const
|
|
536
|
-
|
|
534
|
+
const canvasRect = this.container.getBoundingClientRect();
|
|
535
|
+
const parentRect = parentEl.getBoundingClientRect();
|
|
536
|
+
const left = Math.max(parentRect.left, canvasRect.left) - canvasRect.left;
|
|
537
|
+
const top = Math.max(parentRect.top, canvasRect.top) - canvasRect.top;
|
|
538
|
+
const right = Math.max(left, Math.min(parentRect.right, canvasRect.right) - canvasRect.left);
|
|
539
|
+
const bottom = Math.max(top, Math.min(parentRect.bottom, canvasRect.bottom) - canvasRect.top);
|
|
540
|
+
const corners = [
|
|
541
|
+
[left, top],
|
|
542
|
+
[right, top],
|
|
543
|
+
[right, bottom],
|
|
544
|
+
[left, bottom]
|
|
545
|
+
].map((point) => this._maplibreMap.unproject(point));
|
|
546
|
+
const lngs = corners.map((c) => c.lng);
|
|
547
|
+
const lats = corners.map((c) => c.lat);
|
|
548
|
+
return [Math.min(...lngs), Math.min(...lats), Math.max(...lngs), Math.max(...lats)];
|
|
537
549
|
}
|
|
538
550
|
/**
|
|
539
551
|
* Set feature state properties for a map feature.
|
|
@@ -665,6 +677,15 @@ const _FlowCoreMap = class _FlowCoreMap extends EventEmitter {
|
|
|
665
677
|
state: feature.state
|
|
666
678
|
};
|
|
667
679
|
}
|
|
680
|
+
/**
|
|
681
|
+
* Queries the rendered features of interactive layers at the mouse position, in top-down draw order so the first
|
|
682
|
+
* is the one drawn on top.
|
|
683
|
+
*/
|
|
684
|
+
queryFeatures(event) {
|
|
685
|
+
const layerIds = this._style.getLayers((layer) => layer.interactive).map((layer) => layer.id);
|
|
686
|
+
const maplibreFeatures = this._maplibreMap.queryRenderedFeatures(this.featureQueryBox(event), { layers: layerIds });
|
|
687
|
+
return sortFeaturesByDrawOrder(maplibreFeatures).map(this.featureFromMaplibreFeature.bind(this));
|
|
688
|
+
}
|
|
668
689
|
featureQueryBox(event) {
|
|
669
690
|
const queryBox = this._options.featureClickTolerance ? [
|
|
670
691
|
[event.point.x - this._options.featureClickTolerance, event.point.y - this._options.featureClickTolerance],
|
|
@@ -705,8 +726,7 @@ const _FlowCoreMap = class _FlowCoreMap extends EventEmitter {
|
|
|
705
726
|
}
|
|
706
727
|
handleMouseClick(type) {
|
|
707
728
|
return (event) => {
|
|
708
|
-
const
|
|
709
|
-
const features = this._maplibreMap.queryRenderedFeatures(this.featureQueryBox(event), { layers: layerIds }).map(this.featureFromMaplibreFeature.bind(this));
|
|
729
|
+
const features = this.queryFeatures(event);
|
|
710
730
|
if (features.length) {
|
|
711
731
|
debug(`${this.formattedName} Feature ${type}ed`, features[0]);
|
|
712
732
|
}
|
|
@@ -716,8 +736,7 @@ const _FlowCoreMap = class _FlowCoreMap extends EventEmitter {
|
|
|
716
736
|
}
|
|
717
737
|
handleMouseMove(event) {
|
|
718
738
|
if (event.type === "mousemove") {
|
|
719
|
-
const
|
|
720
|
-
const features = this._maplibreMap.queryRenderedFeatures(this.featureQueryBox(event), { layers: layerIds }).map(this.featureFromMaplibreFeature.bind(this));
|
|
739
|
+
const features = this.queryFeatures(event);
|
|
721
740
|
const flowEvent = MapMouseEvent.fromMaplibreMouseEvent("mouseMove", event, this, features);
|
|
722
741
|
this.emitEvent(flowEvent);
|
|
723
742
|
} else if (event.type === "mouseout") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a3 as MapEvent, a0 as FlowCoreMap, Y as MapSourceIdentifier, av as MapFeatureId, aw as MapPluginBase, ax as PluginManager, a5 as MapSourceEvent, a4 as MapMouseEvent, Z as MapFeatureStream, ay as PartialBy, T as MapAnimationOptions, a7 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, a9 as MapPopupOptions, aa as MapPopup, W as MapFeatureIdentifier } from '../../../shared/flow-rdf-core.
|
|
2
|
-
export { aC as EventHandlers, aB as PluginConstructor, aA as PluginEventsType, az as PluginOptionsType } from '../../../shared/flow-rdf-core.
|
|
1
|
+
import { a3 as MapEvent, a0 as FlowCoreMap, Y as MapSourceIdentifier, av as MapFeatureId, aw as MapPluginBase, ax as PluginManager, a5 as MapSourceEvent, a4 as MapMouseEvent, Z as MapFeatureStream, ay as PartialBy, T as MapAnimationOptions, a7 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, a9 as MapPopupOptions, aa as MapPopup, W as MapFeatureIdentifier } from '../../../shared/flow-rdf-core.dcf0da97.mjs';
|
|
2
|
+
export { aC as EventHandlers, aB as PluginConstructor, aA as PluginEventsType, az as PluginOptionsType } from '../../../shared/flow-rdf-core.dcf0da97.mjs';
|
|
3
3
|
import { F as Func } from '../../../shared/flow-rdf-core.63162669.mjs';
|
|
4
4
|
import 'eventemitter3';
|
|
5
5
|
import 'lit-html';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a3 as MapEvent, a0 as FlowCoreMap, Y as MapSourceIdentifier, av as MapFeatureId, aw as MapPluginBase, ax as PluginManager, a5 as MapSourceEvent, a4 as MapMouseEvent, Z as MapFeatureStream, ay as PartialBy, T as MapAnimationOptions, a7 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, a9 as MapPopupOptions, aa as MapPopup, W as MapFeatureIdentifier } from '../../../shared/flow-rdf-core.
|
|
2
|
-
export { aC as EventHandlers, aB as PluginConstructor, aA as PluginEventsType, az as PluginOptionsType } from '../../../shared/flow-rdf-core.
|
|
1
|
+
import { a3 as MapEvent, a0 as FlowCoreMap, Y as MapSourceIdentifier, av as MapFeatureId, aw as MapPluginBase, ax as PluginManager, a5 as MapSourceEvent, a4 as MapMouseEvent, Z as MapFeatureStream, ay as PartialBy, T as MapAnimationOptions, a7 as MapStyleChangeEvent, M as MapStyleSpecification, S as StateStore, a9 as MapPopupOptions, aa as MapPopup, W as MapFeatureIdentifier } from '../../../shared/flow-rdf-core.dcf0da97.js';
|
|
2
|
+
export { aC as EventHandlers, aB as PluginConstructor, aA as PluginEventsType, az as PluginOptionsType } from '../../../shared/flow-rdf-core.dcf0da97.js';
|
|
3
3
|
import { F as Func } from '../../../shared/flow-rdf-core.63162669.js';
|
|
4
4
|
import 'eventemitter3';
|
|
5
5
|
import 'lit-html';
|
|
@@ -40,8 +40,9 @@ class MapMouseEvent extends MapEvent {
|
|
|
40
40
|
*/
|
|
41
41
|
__publicField(this, "lngLat");
|
|
42
42
|
/**
|
|
43
|
-
* Features found at the mouse coordinate
|
|
44
|
-
* Features
|
|
43
|
+
* Features found at the mouse coordinate, in top-down draw order: the first feature is the one drawn on top.
|
|
44
|
+
* Features in higher layers come first and, within a layer that uses a sort key (such as `circle-sort-key`),
|
|
45
|
+
* features with a higher sort key come first. Features from non-interactive layers are excluded.
|
|
45
46
|
*/
|
|
46
47
|
__publicField(this, "features");
|
|
47
48
|
this.point = point;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const SORT_KEY_PROPERTIES = {
|
|
2
|
+
circle: "circle-sort-key",
|
|
3
|
+
fill: "fill-sort-key",
|
|
4
|
+
line: "line-sort-key",
|
|
5
|
+
symbol: "symbol-sort-key"
|
|
6
|
+
};
|
|
7
|
+
function drawSortKey(feature) {
|
|
8
|
+
const property = SORT_KEY_PROPERTIES[feature.layer.type];
|
|
9
|
+
const layout = feature.layer.layout;
|
|
10
|
+
if (!property || !layout)
|
|
11
|
+
return void 0;
|
|
12
|
+
if (feature.layer.type === "symbol" && layout["symbol-z-order"] === "viewport-y")
|
|
13
|
+
return void 0;
|
|
14
|
+
const key = layout[property];
|
|
15
|
+
return typeof key === "number" && Number.isFinite(key) ? key : void 0;
|
|
16
|
+
}
|
|
17
|
+
function sortRun(features, start, end) {
|
|
18
|
+
const keyed = [];
|
|
19
|
+
const positions = [];
|
|
20
|
+
for (let i = start; i < end; i++) {
|
|
21
|
+
const key = drawSortKey(features[i]);
|
|
22
|
+
if (key !== void 0) {
|
|
23
|
+
keyed.push({ feature: features[i], key });
|
|
24
|
+
positions.push(i);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (keyed.length < 2)
|
|
28
|
+
return;
|
|
29
|
+
keyed.sort((a, b) => b.key - a.key);
|
|
30
|
+
keyed.forEach((item, index) => {
|
|
31
|
+
features[positions[index]] = item.feature;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function sortFeaturesByDrawOrder(features) {
|
|
35
|
+
const sorted = features.slice();
|
|
36
|
+
let start = 0;
|
|
37
|
+
while (start < sorted.length) {
|
|
38
|
+
const layerId = sorted[start].layer.id;
|
|
39
|
+
let end = start + 1;
|
|
40
|
+
while (end < sorted.length && sorted[end].layer.id === layerId)
|
|
41
|
+
end++;
|
|
42
|
+
if (end - start > 1)
|
|
43
|
+
sortRun(sorted, start, end);
|
|
44
|
+
start = end;
|
|
45
|
+
}
|
|
46
|
+
return sorted;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { sortFeaturesByDrawOrder };
|
package/dist/package.json.mjs
CHANGED
|
@@ -591,7 +591,7 @@ declare class FlowCoreExpressionError extends FlowCoreError {
|
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
593
|
* A Flo.w RDF reactive expression - used internally to parse and evaluate {@link MapLayer}
|
|
594
|
-
* style [expressions](/flow-rdf-core/expression-reference/). An expression can be evaluated
|
|
594
|
+
* style [expressions](/flow-rdf/flow-rdf-core/expression-reference/). An expression can be evaluated
|
|
595
595
|
* and its MapLibre-compatible representation can be generated.
|
|
596
596
|
*
|
|
597
597
|
* @example
|
|
@@ -2179,8 +2179,9 @@ declare class MapMouseEvent extends MapEvent<MapMouseEventType, MouseEvent> {
|
|
|
2179
2179
|
*/
|
|
2180
2180
|
lngLat: [number, number];
|
|
2181
2181
|
/**
|
|
2182
|
-
* Features found at the mouse coordinate
|
|
2183
|
-
* Features
|
|
2182
|
+
* Features found at the mouse coordinate, in top-down draw order: the first feature is the one drawn on top.
|
|
2183
|
+
* Features in higher layers come first and, within a layer that uses a sort key (such as `circle-sort-key`),
|
|
2184
|
+
* features with a higher sort key come first. Features from non-interactive layers are excluded.
|
|
2184
2185
|
*/
|
|
2185
2186
|
features: MapFeature[];
|
|
2186
2187
|
static fromMaplibreMouseEvent(type: MapMouseEventType, maplibreMouseEvent: MapMouseEvent$1, map: FlowCoreMap, features: MapFeature[]): MapMouseEvent;
|
|
@@ -2922,8 +2923,8 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
|
|
|
2922
2923
|
/**
|
|
2923
2924
|
* Register a map icon image.
|
|
2924
2925
|
*
|
|
2925
|
-
* The image can be used on [symbol-type map layers](/flow-rdf-core/layer-reference/symbol) by specifying
|
|
2926
|
-
* as the [`iconImage`](/flow-rdf-core/layer-reference/symbol#icon-image) property.
|
|
2926
|
+
* The image can be used on [symbol-type map layers](/flow-rdf/flow-rdf-core/layer-reference/symbol) by specifying
|
|
2927
|
+
* the image ID as the [`iconImage`](/flow-rdf/flow-rdf-core/layer-reference/symbol#icon-image) property.
|
|
2927
2928
|
*
|
|
2928
2929
|
* :::warning
|
|
2929
2930
|
* To fully support recoloring and halo effects, the source image should be a SDF (signed distance field) image.
|
|
@@ -3030,10 +3031,11 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
|
|
|
3030
3031
|
/**
|
|
3031
3032
|
* Returns the map's current visible bounds in degrees as an array of `[west, south, east, north]`.
|
|
3032
3033
|
*
|
|
3033
|
-
* The visible bounds
|
|
3034
|
-
*
|
|
3035
|
-
*
|
|
3036
|
-
*
|
|
3034
|
+
* The visible bounds are the bounds of the part of the map's canvas that lies within the parent element of the
|
|
3035
|
+
* map's container (the `flow-ui-map` element). They differ from the map's full bounds when the `fixed` mode of
|
|
3036
|
+
* `flow-ui-map` is used. In that mode, the canvas fills the viewport and is clipped to the `flow-ui-map` element,
|
|
3037
|
+
* so that side bars can be opened and closed without re-rendering the map. Otherwise the canvas fills the element,
|
|
3038
|
+
* and the visible bounds are the full bounds.
|
|
3037
3039
|
*
|
|
3038
3040
|
* See also {@link getBounds}.
|
|
3039
3041
|
*/
|
|
@@ -3105,6 +3107,11 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
|
|
|
3105
3107
|
private get formattedName();
|
|
3106
3108
|
private bindMapEvents;
|
|
3107
3109
|
private featureFromMaplibreFeature;
|
|
3110
|
+
/**
|
|
3111
|
+
* Queries the rendered features of interactive layers at the mouse position, in top-down draw order so the first
|
|
3112
|
+
* is the one drawn on top.
|
|
3113
|
+
*/
|
|
3114
|
+
private queryFeatures;
|
|
3108
3115
|
private featureQueryBox;
|
|
3109
3116
|
private handleLoading;
|
|
3110
3117
|
private handleMissingImage;
|
|
@@ -591,7 +591,7 @@ declare class FlowCoreExpressionError extends FlowCoreError {
|
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
593
|
* A Flo.w RDF reactive expression - used internally to parse and evaluate {@link MapLayer}
|
|
594
|
-
* style [expressions](/flow-rdf-core/expression-reference/). An expression can be evaluated
|
|
594
|
+
* style [expressions](/flow-rdf/flow-rdf-core/expression-reference/). An expression can be evaluated
|
|
595
595
|
* and its MapLibre-compatible representation can be generated.
|
|
596
596
|
*
|
|
597
597
|
* @example
|
|
@@ -2179,8 +2179,9 @@ declare class MapMouseEvent extends MapEvent<MapMouseEventType, MouseEvent> {
|
|
|
2179
2179
|
*/
|
|
2180
2180
|
lngLat: [number, number];
|
|
2181
2181
|
/**
|
|
2182
|
-
* Features found at the mouse coordinate
|
|
2183
|
-
* Features
|
|
2182
|
+
* Features found at the mouse coordinate, in top-down draw order: the first feature is the one drawn on top.
|
|
2183
|
+
* Features in higher layers come first and, within a layer that uses a sort key (such as `circle-sort-key`),
|
|
2184
|
+
* features with a higher sort key come first. Features from non-interactive layers are excluded.
|
|
2184
2185
|
*/
|
|
2185
2186
|
features: MapFeature[];
|
|
2186
2187
|
static fromMaplibreMouseEvent(type: MapMouseEventType, maplibreMouseEvent: MapMouseEvent$1, map: FlowCoreMap, features: MapFeature[]): MapMouseEvent;
|
|
@@ -2922,8 +2923,8 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
|
|
|
2922
2923
|
/**
|
|
2923
2924
|
* Register a map icon image.
|
|
2924
2925
|
*
|
|
2925
|
-
* The image can be used on [symbol-type map layers](/flow-rdf-core/layer-reference/symbol) by specifying
|
|
2926
|
-
* as the [`iconImage`](/flow-rdf-core/layer-reference/symbol#icon-image) property.
|
|
2926
|
+
* The image can be used on [symbol-type map layers](/flow-rdf/flow-rdf-core/layer-reference/symbol) by specifying
|
|
2927
|
+
* the image ID as the [`iconImage`](/flow-rdf/flow-rdf-core/layer-reference/symbol#icon-image) property.
|
|
2927
2928
|
*
|
|
2928
2929
|
* :::warning
|
|
2929
2930
|
* To fully support recoloring and halo effects, the source image should be a SDF (signed distance field) image.
|
|
@@ -3030,10 +3031,11 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
|
|
|
3030
3031
|
/**
|
|
3031
3032
|
* Returns the map's current visible bounds in degrees as an array of `[west, south, east, north]`.
|
|
3032
3033
|
*
|
|
3033
|
-
* The visible bounds
|
|
3034
|
-
*
|
|
3035
|
-
*
|
|
3036
|
-
*
|
|
3034
|
+
* The visible bounds are the bounds of the part of the map's canvas that lies within the parent element of the
|
|
3035
|
+
* map's container (the `flow-ui-map` element). They differ from the map's full bounds when the `fixed` mode of
|
|
3036
|
+
* `flow-ui-map` is used. In that mode, the canvas fills the viewport and is clipped to the `flow-ui-map` element,
|
|
3037
|
+
* so that side bars can be opened and closed without re-rendering the map. Otherwise the canvas fills the element,
|
|
3038
|
+
* and the visible bounds are the full bounds.
|
|
3037
3039
|
*
|
|
3038
3040
|
* See also {@link getBounds}.
|
|
3039
3041
|
*/
|
|
@@ -3105,6 +3107,11 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
|
|
|
3105
3107
|
private get formattedName();
|
|
3106
3108
|
private bindMapEvents;
|
|
3107
3109
|
private featureFromMaplibreFeature;
|
|
3110
|
+
/**
|
|
3111
|
+
* Queries the rendered features of interactive layers at the mouse position, in top-down draw order so the first
|
|
3112
|
+
* is the one drawn on top.
|
|
3113
|
+
*/
|
|
3114
|
+
private queryFeatures;
|
|
3108
3115
|
private featureQueryBox;
|
|
3109
3116
|
private handleLoading;
|
|
3110
3117
|
private handleMissingImage;
|