@octostar/map-component 0.2.20 → 0.2.21

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.cjs CHANGED
@@ -7133,6 +7133,269 @@ function hitTestSelection(featureGroups, selectionPolygon, options) {
7133
7133
  mapPerfLog("hit-test", "selection gesture", { visited, total, selected: selectedIds.length });
7134
7134
  return selectedIds;
7135
7135
  }
7136
+ const LABEL_NEVER_HIDE_PROP = "_labelNeverHide";
7137
+ const PINNED_LABEL_FILTER = ["==", ["get", LABEL_NEVER_HIDE_PROP], 1];
7138
+ const UNPINNED_LABEL_FILTER = ["!=", ["get", LABEL_NEVER_HIDE_PROP], 1];
7139
+ function computeLabelNeverHide(label) {
7140
+ return (label == null ? void 0 : label.neverHide) && !label.hidden ? 1 : 0;
7141
+ }
7142
+ function buildCustomLabelLayout() {
7143
+ return {
7144
+ // Hide labels for trace points (except last point which has isTraceLabel),
7145
+ // arrows handled by the custom-arrow-labels layer. Features blanked by
7146
+ // heatmap/cluster modes stay blank in BOTH layers: "never hide"
7147
+ // exempts labels from collision and density culling, it does not resurrect
7148
+ // labels other mode choices explicitly blank.
7149
+ "text-field": [
7150
+ "case",
7151
+ ["==", ["get", "isHiddenByHeatmap"], 1],
7152
+ "",
7153
+ ["==", ["get", "isHiddenByCluster"], 1],
7154
+ "",
7155
+ ["==", ["get", "kind"], "arrow"],
7156
+ "",
7157
+ // Trace points: only show label if isTraceLabel is true (last point in group)
7158
+ ["all", ["==", ["get", "isTracePoint"], true], ["!=", ["get", "isTraceLabel"], true]],
7159
+ "",
7160
+ ["==", ["get", "kind"], "text"],
7161
+ ["coalesce", ["get", "label"], ["get", "text"], "New Label"],
7162
+ ["coalesce", ["get", "name"], ""]
7163
+ ],
7164
+ // Text features use their fontSize property; trace labels 14px; others 12px
7165
+ "text-size": [
7166
+ "case",
7167
+ ["==", ["get", "kind"], "text"],
7168
+ ["coalesce", ["get", "fontSize"], 14],
7169
+ ["==", ["get", "isTraceLabel"], true],
7170
+ 14,
7171
+ 12
7172
+ ],
7173
+ // Text features: center anchor; others: top anchor
7174
+ "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
7175
+ "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
7176
+ "text-padding": 2,
7177
+ // Bold font for text features with fontWeight=bold, trace labels, others regular
7178
+ "text-font": [
7179
+ "case",
7180
+ ["all", ["==", ["get", "kind"], "text"], ["==", ["get", "fontWeight"], "bold"]],
7181
+ ["literal", ["Montserrat SemiBold", "Noto Sans Regular"]],
7182
+ ["==", ["get", "isTraceLabel"], true],
7183
+ ["literal", ["Montserrat Medium", "Noto Sans Regular"]],
7184
+ ["literal", ["Montserrat Regular", "Noto Sans Regular"]]
7185
+ ]
7186
+ };
7187
+ }
7188
+ function buildCustomLabelPaint() {
7189
+ return {
7190
+ // Text features use fontColor; others use default
7191
+ "text-color": [
7192
+ "case",
7193
+ ["==", ["get", "kind"], "text"],
7194
+ ["coalesce", ["get", "fontColor"], "#000000"],
7195
+ "#1f2937"
7196
+ ],
7197
+ "text-halo-color": "#ffffff",
7198
+ // Thicker halo for trace labels and text features
7199
+ "text-halo-width": [
7200
+ "case",
7201
+ ["==", ["get", "kind"], "text"],
7202
+ 2,
7203
+ ["==", ["get", "isTraceLabel"], true],
7204
+ 2,
7205
+ 1.5
7206
+ ],
7207
+ "text-opacity": ["*", 0.9, ["get", "stroke-opacity"]]
7208
+ };
7209
+ }
7210
+ const RENDER_PASSTHROUGH_KEYS = ["_dvl_h3"];
7211
+ const ANNOTATION_PASSTHROUGH_KEYS = [
7212
+ "kind",
7213
+ "text",
7214
+ "label",
7215
+ "fontSize",
7216
+ "fontColor",
7217
+ "fontWeight",
7218
+ "arrowSize"
7219
+ ];
7220
+ function sanitizeValue(value) {
7221
+ if (value === null || value === void 0) return null;
7222
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
7223
+ if (value instanceof Date) return value.toISOString();
7224
+ return String(value);
7225
+ }
7226
+ function styleFeatureForPaint(f, layer, ctx, slim) {
7227
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
7228
+ const featureId = String(f.id);
7229
+ const visualConfig = layer == null ? void 0 : layer.visualConfig;
7230
+ const isTimelineVisible = ctx.timelineVisibleIds === null || ctx.timelineVisibleIds.has(featureId);
7231
+ const baseOpacity = ((_a = f.properties) == null ? void 0 : _a["stroke-opacity"]) ?? DEFAULT_VISIBLE_STROKE_OPACITY;
7232
+ let strokeColor = ((_b = f.properties) == null ? void 0 : _b.stroke) || "#3b82f6";
7233
+ const colorConfig = visualConfig == null ? void 0 : visualConfig.color;
7234
+ if (colorConfig) {
7235
+ strokeColor = resolveFeatureColor(
7236
+ colorConfig,
7237
+ f.properties,
7238
+ strokeColor,
7239
+ layer ? ctx.colorFieldRanges.get(layer.id) : void 0
7240
+ );
7241
+ }
7242
+ let strokeWidth = ((_c = f.properties) == null ? void 0 : _c["stroke-width"]) || 2;
7243
+ let pointRadius = Math.round(3 + strokeWidth);
7244
+ const sizeConfig = visualConfig == null ? void 0 : visualConfig.size;
7245
+ if (sizeConfig) {
7246
+ if (sizeConfig.mode === "override" && sizeConfig.overrideValue !== void 0) {
7247
+ strokeWidth = Math.max(1, Math.min(10, sizeConfig.overrideValue));
7248
+ pointRadius = Math.round(3 + strokeWidth);
7249
+ } else if (sizeConfig.mode === "field" && sizeConfig.fieldName && layer) {
7250
+ const range = ctx.sizeFieldRanges.get(layer.id);
7251
+ if (range && f.properties) {
7252
+ const rawVal = f.properties[sizeConfig.fieldName];
7253
+ const val = typeof rawVal === "number" ? rawVal : typeof rawVal === "string" && rawVal.trim() !== "" ? Number(rawVal) : NaN;
7254
+ if (isFinite(val)) {
7255
+ const normalized = range.max > range.min ? (val - range.min) / (range.max - range.min) : 0.5;
7256
+ strokeWidth = 2 + normalized * 8;
7257
+ pointRadius = Math.round(2 + normalized * 16);
7258
+ }
7259
+ }
7260
+ }
7261
+ }
7262
+ const isTracePoint = ctx.tracePointIds.has(featureId);
7263
+ const isLastTracePoint = ctx.lastTracePointIds.has(featureId);
7264
+ const traceLabel = ctx.lastTracePointLabels.get(featureId);
7265
+ let traceEndpointRadius = null;
7266
+ if (isTracePoint && f.geometry.type === "Point") {
7267
+ strokeColor = ctx.tracePointColors.get(featureId) || strokeColor;
7268
+ traceEndpointRadius = Math.max(pointRadius, TRACE_ENDPOINT_MIN_RADIUS);
7269
+ pointRadius = isLastTracePoint ? traceEndpointRadius : TRACE_POINT_RADIUS;
7270
+ }
7271
+ let labelText = ((_d = f.properties) == null ? void 0 : _d.name) || "";
7272
+ const labelConfig = visualConfig == null ? void 0 : visualConfig.label;
7273
+ if (labelConfig == null ? void 0 : labelConfig.hidden) {
7274
+ labelText = "";
7275
+ } else if (labelConfig) {
7276
+ if (labelConfig.mode === "fixed" && labelConfig.fixedText) {
7277
+ labelText = labelConfig.fixedText;
7278
+ } else if (labelConfig.mode === "field" && labelConfig.fieldName && f.properties) {
7279
+ const fieldValue = f.properties[labelConfig.fieldName];
7280
+ labelText = fieldValue !== void 0 && fieldValue !== null ? String(fieldValue) : "";
7281
+ }
7282
+ }
7283
+ const nonTraceLabelText = labelText;
7284
+ if (traceLabel) {
7285
+ labelText = traceLabel;
7286
+ }
7287
+ let featureIcon = ((_e = f.properties) == null ? void 0 : _e.pointIcon) || ((_f = f.properties) == null ? void 0 : _f.icon);
7288
+ let featureIconSize = ((_g = f.properties) == null ? void 0 : _g.pointIconSize) || ((_h = f.properties) == null ? void 0 : _h.iconSize) || 24;
7289
+ const iconConfig = visualConfig == null ? void 0 : visualConfig.icon;
7290
+ if ((iconConfig == null ? void 0 : iconConfig.enabled) && iconConfig.icon && !featureIcon) {
7291
+ featureIcon = iconConfig.icon;
7292
+ featureIconSize = iconConfig.size ?? 24;
7293
+ }
7294
+ const isPoint = f.geometry.type === "Point";
7295
+ const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
7296
+ const hideByCluster = isPoint && ((_j = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _j.enabled) === true && !((_k = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _k.showPointDots);
7297
+ const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
7298
+ const hideFlatFor3DOnly = isLine && (layer == null ? void 0 : layer.hasAltitudeData) && (layer == null ? void 0 : layer.altitudeDisplayMode) === "3d";
7299
+ const sanitizedProps = {};
7300
+ const props = f.properties;
7301
+ if (props) {
7302
+ if (slim) {
7303
+ RENDER_PASSTHROUGH_KEYS.forEach((key) => {
7304
+ if (key in props) sanitizedProps[key] = sanitizeValue(props[key]);
7305
+ });
7306
+ if (typeof props.kind === "string") {
7307
+ ANNOTATION_PASSTHROUGH_KEYS.forEach((key) => {
7308
+ if (key in props) sanitizedProps[key] = sanitizeValue(props[key]);
7309
+ });
7310
+ }
7311
+ } else {
7312
+ Object.entries(props).forEach(([key, value]) => {
7313
+ sanitizedProps[key] = sanitizeValue(value);
7314
+ });
7315
+ }
7316
+ }
7317
+ const isFeatureSelected = ctx.selectionEnabled && ctx.selectedIds.has(featureId) ? 1 : 0;
7318
+ let nonTracePriority = DEFAULT_LABEL_PRIORITY;
7319
+ if (((_l = f.properties) == null ? void 0 : _l.kind) === "text") {
7320
+ nonTracePriority = ((_m = f.properties) == null ? void 0 : _m.fontWeight) === "bold" ? 8 : 10;
7321
+ } else {
7322
+ const idStr = String(featureId);
7323
+ let h = 0;
7324
+ for (let i = 0; i < idStr.length; i++) {
7325
+ h = (h << 5) - h + idStr.charCodeAt(i);
7326
+ h |= 0;
7327
+ }
7328
+ nonTracePriority = DEFAULT_LABEL_PRIORITY + Math.abs(h) % 1e3;
7329
+ }
7330
+ const basePriority = traceLabel ? TRACE_ENDPOINT_LABEL_PRIORITY : nonTracePriority;
7331
+ const labelPriority = isFeatureSelected ? 0 : basePriority;
7332
+ const visibleStrokeOpacity = hideFlatFor3DOnly ? 0 : baseOpacity;
7333
+ const visibleFillOpacity = hideFlatFor3DOnly ? 0 : ((_n = f.properties) == null ? void 0 : _n["fill-opacity"]) ?? DEFAULT_VISIBLE_FILL_OPACITY;
7334
+ return {
7335
+ feature: {
7336
+ type: "Feature",
7337
+ id: featureId,
7338
+ geometry: f.geometry,
7339
+ properties: {
7340
+ // Record fields (draw features) or just the passthroughs (read-only)
7341
+ ...sanitizedProps,
7342
+ // Override with computed visual properties
7343
+ id: featureId,
7344
+ name: labelText,
7345
+ isSelected: isFeatureSelected,
7346
+ isHiddenByHeatmap: hideByHeatmap ? 1 : 0,
7347
+ isHiddenByCluster: hideByCluster ? 1 : 0,
7348
+ isTracePoint: isTracePoint ? true : false,
7349
+ isTraceLabel: traceLabel ? true : false,
7350
+ icon: featureIcon || "",
7351
+ iconSize: featureIconSize,
7352
+ stroke: strokeColor,
7353
+ "stroke-width": strokeWidth,
7354
+ "stroke-opacity": isTimelineVisible ? visibleStrokeOpacity : 0,
7355
+ fill: strokeColor,
7356
+ "fill-opacity": isTimelineVisible ? visibleFillOpacity : 0,
7357
+ pointRadius,
7358
+ isTimelineHidden: isTimelineVisible ? 0 : 1,
7359
+ _labelPriority: labelPriority,
7360
+ [LABEL_NEVER_HIDE_PROP]: computeLabelNeverHide((_o = layer == null ? void 0 : layer.visualConfig) == null ? void 0 : _o.label)
7361
+ }
7362
+ },
7363
+ paint: {
7364
+ featureId,
7365
+ basePriority,
7366
+ selected: isFeatureSelected === 1,
7367
+ visibleStrokeOpacity,
7368
+ visibleFillOpacity,
7369
+ timelineHidden: !isTimelineVisible
7370
+ },
7371
+ tracePaint: traceEndpointRadius !== null ? { name: nonTraceLabelText, endpointRadius: traceEndpointRadius, basePriority: nonTracePriority } : null
7372
+ };
7373
+ }
7374
+ function renderedFeatureId(f) {
7375
+ var _a;
7376
+ const fromProps = (_a = f.properties) == null ? void 0 : _a.id;
7377
+ if (fromProps !== void 0 && fromProps !== null && fromProps !== "") return String(fromProps);
7378
+ if (f.id !== void 0 && f.id !== null && f.id !== "") return String(f.id);
7379
+ return null;
7380
+ }
7381
+ function resolveTooltipFeature(rendered, lookup) {
7382
+ const id = renderedFeatureId(rendered);
7383
+ const stored = id === null ? null : lookup(id);
7384
+ if (stored) {
7385
+ return deepClone({
7386
+ type: "Feature",
7387
+ geometry: stored.geometry,
7388
+ properties: stored.properties ?? {},
7389
+ id: stored.id
7390
+ });
7391
+ }
7392
+ return {
7393
+ type: "Feature",
7394
+ geometry: rendered.geometry,
7395
+ properties: { ...rendered.properties ?? {} },
7396
+ id: rendered.id
7397
+ };
7398
+ }
7136
7399
  const CLUSTER_COUNT_VALUE_PROP = "__cluster_count_value";
7137
7400
  const CLUSTER_SUM_PROP = "value_sum";
7138
7401
  const CLUSTER_MEMBER_ID_PROP = "__cluster_fid";
@@ -7326,82 +7589,6 @@ function createClusterGradientManager(map, sourceId, options) {
7326
7589
  }
7327
7590
  };
7328
7591
  }
7329
- const LABEL_NEVER_HIDE_PROP = "_labelNeverHide";
7330
- const PINNED_LABEL_FILTER = ["==", ["get", LABEL_NEVER_HIDE_PROP], 1];
7331
- const UNPINNED_LABEL_FILTER = ["!=", ["get", LABEL_NEVER_HIDE_PROP], 1];
7332
- function computeLabelNeverHide(label) {
7333
- return (label == null ? void 0 : label.neverHide) && !label.hidden ? 1 : 0;
7334
- }
7335
- function buildCustomLabelLayout() {
7336
- return {
7337
- // Hide labels for trace points (except last point which has isTraceLabel),
7338
- // arrows handled by the custom-arrow-labels layer. Features blanked by
7339
- // heatmap/cluster/trace modes stay blank in BOTH layers: "never hide"
7340
- // exempts labels from collision and density culling, it does not resurrect
7341
- // labels other mode choices explicitly blank.
7342
- "text-field": [
7343
- "case",
7344
- ["==", ["get", "isHiddenByTrace"], true],
7345
- "",
7346
- ["==", ["get", "isHiddenByHeatmap"], 1],
7347
- "",
7348
- ["==", ["get", "isHiddenByCluster"], 1],
7349
- "",
7350
- ["==", ["get", "kind"], "arrow"],
7351
- "",
7352
- // Trace points: only show label if isTraceLabel is true (last point in group)
7353
- ["all", ["==", ["get", "isTracePoint"], true], ["!=", ["get", "isTraceLabel"], true]],
7354
- "",
7355
- ["==", ["get", "kind"], "text"],
7356
- ["coalesce", ["get", "label"], ["get", "text"], "New Label"],
7357
- ["coalesce", ["get", "name"], ""]
7358
- ],
7359
- // Text features use their fontSize property; trace labels 14px; others 12px
7360
- "text-size": [
7361
- "case",
7362
- ["==", ["get", "kind"], "text"],
7363
- ["coalesce", ["get", "fontSize"], 14],
7364
- ["==", ["get", "isTraceLabel"], true],
7365
- 14,
7366
- 12
7367
- ],
7368
- // Text features: center anchor; others: top anchor
7369
- "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
7370
- "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
7371
- "text-padding": 2,
7372
- // Bold font for text features with fontWeight=bold, trace labels, others regular
7373
- "text-font": [
7374
- "case",
7375
- ["all", ["==", ["get", "kind"], "text"], ["==", ["get", "fontWeight"], "bold"]],
7376
- ["literal", ["Montserrat SemiBold", "Noto Sans Regular"]],
7377
- ["==", ["get", "isTraceLabel"], true],
7378
- ["literal", ["Montserrat Medium", "Noto Sans Regular"]],
7379
- ["literal", ["Montserrat Regular", "Noto Sans Regular"]]
7380
- ]
7381
- };
7382
- }
7383
- function buildCustomLabelPaint() {
7384
- return {
7385
- // Text features use fontColor; others use default
7386
- "text-color": [
7387
- "case",
7388
- ["==", ["get", "kind"], "text"],
7389
- ["coalesce", ["get", "fontColor"], "#000000"],
7390
- "#1f2937"
7391
- ],
7392
- "text-halo-color": "#ffffff",
7393
- // Thicker halo for trace labels and text features
7394
- "text-halo-width": [
7395
- "case",
7396
- ["==", ["get", "kind"], "text"],
7397
- 2,
7398
- ["==", ["get", "isTraceLabel"], true],
7399
- 2,
7400
- 1.5
7401
- ],
7402
- "text-opacity": ["*", 0.9, ["get", "stroke-opacity"]]
7403
- };
7404
- }
7405
7592
  const OTHER_BUCKET_KEY = "__other__";
7406
7593
  const OTHER_BUCKET_LABEL = "Other";
7407
7594
  const OTHER_BUCKET_COLOR = "#9ca3af";
@@ -8689,156 +8876,34 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
8689
8876
  }
8690
8877
  });
8691
8878
  const paintCache = createSelectionPaintCache();
8879
+ const paintContext = {
8880
+ timelineVisibleIds: visibleSet,
8881
+ selectedIds: selectedIdSet,
8882
+ selectionEnabled: enableSelectionRef.current || enableDrawingRef.current,
8883
+ sizeFieldRanges,
8884
+ colorFieldRanges,
8885
+ tracePointIds,
8886
+ lastTracePointIds,
8887
+ lastTracePointLabels,
8888
+ tracePointColors
8889
+ };
8890
+ const drawFeatureCount = drawFeatures.features.length;
8692
8891
  const sourceData = {
8693
8892
  type: "FeatureCollection",
8694
- features: allFeatures.map((f) => {
8695
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
8696
- const featureId = String(f.id);
8697
- const layer = featureToLayer.get(featureId);
8698
- const visualConfig = layer == null ? void 0 : layer.visualConfig;
8699
- const isTimelineVisible = visibleSet === null || visibleSet.has(featureId);
8700
- const baseOpacity = ((_a = f.properties) == null ? void 0 : _a["stroke-opacity"]) ?? DEFAULT_VISIBLE_STROKE_OPACITY;
8701
- let strokeColor = ((_b = f.properties) == null ? void 0 : _b.stroke) || "#3b82f6";
8702
- const colorConfig = visualConfig == null ? void 0 : visualConfig.color;
8703
- if (colorConfig) {
8704
- strokeColor = resolveFeatureColor(
8705
- colorConfig,
8706
- f.properties,
8707
- strokeColor,
8708
- layer ? colorFieldRanges.get(layer.id) : void 0
8709
- );
8710
- }
8711
- let strokeWidth = ((_c = f.properties) == null ? void 0 : _c["stroke-width"]) || 2;
8712
- let pointRadius = Math.round(3 + strokeWidth);
8713
- const sizeConfig = visualConfig == null ? void 0 : visualConfig.size;
8714
- if (sizeConfig) {
8715
- if (sizeConfig.mode === "override" && sizeConfig.overrideValue !== void 0) {
8716
- strokeWidth = Math.max(1, Math.min(10, sizeConfig.overrideValue));
8717
- pointRadius = Math.round(3 + strokeWidth);
8718
- } else if (sizeConfig.mode === "field" && sizeConfig.fieldName && layer) {
8719
- const range = sizeFieldRanges.get(layer.id);
8720
- if (range && f.properties) {
8721
- const rawVal = f.properties[sizeConfig.fieldName];
8722
- const val = typeof rawVal === "number" ? rawVal : typeof rawVal === "string" && rawVal.trim() !== "" ? Number(rawVal) : NaN;
8723
- if (isFinite(val)) {
8724
- const normalized = range.max > range.min ? (val - range.min) / (range.max - range.min) : 0.5;
8725
- strokeWidth = 2 + normalized * 8;
8726
- pointRadius = Math.round(2 + normalized * 16);
8727
- }
8728
- }
8729
- }
8730
- }
8731
- const isTracePoint = tracePointIds.has(featureId);
8732
- const isLastTracePoint = lastTracePointIds.has(featureId);
8733
- const traceLabel = lastTracePointLabels.get(featureId);
8734
- let traceEndpointRadius = null;
8735
- if (isTracePoint && f.geometry.type === "Point") {
8736
- strokeColor = tracePointColors.get(featureId) || strokeColor;
8737
- traceEndpointRadius = Math.max(pointRadius, TRACE_ENDPOINT_MIN_RADIUS);
8738
- pointRadius = isLastTracePoint ? traceEndpointRadius : TRACE_POINT_RADIUS;
8739
- }
8740
- let labelText = ((_d = f.properties) == null ? void 0 : _d.name) || "";
8741
- const labelConfig = visualConfig == null ? void 0 : visualConfig.label;
8742
- if (labelConfig == null ? void 0 : labelConfig.hidden) {
8743
- labelText = "";
8744
- } else if (labelConfig) {
8745
- if (labelConfig.mode === "fixed" && labelConfig.fixedText) {
8746
- labelText = labelConfig.fixedText;
8747
- } else if (labelConfig.mode === "field" && labelConfig.fieldName && f.properties) {
8748
- const fieldValue = f.properties[labelConfig.fieldName];
8749
- labelText = fieldValue !== void 0 && fieldValue !== null ? String(fieldValue) : "";
8750
- }
8751
- }
8752
- const nonTraceLabelText = labelText;
8753
- if (traceLabel) {
8754
- labelText = traceLabel;
8755
- }
8756
- let featureIcon = ((_e = f.properties) == null ? void 0 : _e.pointIcon) || ((_f = f.properties) == null ? void 0 : _f.icon);
8757
- let featureIconSize = ((_g = f.properties) == null ? void 0 : _g.pointIconSize) || ((_h = f.properties) == null ? void 0 : _h.iconSize) || 24;
8758
- const iconConfig = visualConfig == null ? void 0 : visualConfig.icon;
8759
- if ((iconConfig == null ? void 0 : iconConfig.enabled) && iconConfig.icon && !featureIcon) {
8760
- featureIcon = iconConfig.icon;
8761
- featureIconSize = iconConfig.size ?? 24;
8762
- }
8763
- const isPoint = f.geometry.type === "Point";
8764
- const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
8765
- const hideByCluster = isPoint && ((_j = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _j.enabled) === true && !((_k = layer == null ? void 0 : layer.clusterConfig) == null ? void 0 : _k.showPointDots);
8766
- const hideByTrace = false;
8767
- const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
8768
- const hideFlatFor3DOnly = isLine && (layer == null ? void 0 : layer.hasAltitudeData) && (layer == null ? void 0 : layer.altitudeDisplayMode) === "3d";
8769
- const sanitizedProps = {};
8770
- if (f.properties) {
8771
- Object.entries(f.properties).forEach(([key, value]) => {
8772
- if (value === null || value === void 0) {
8773
- sanitizedProps[key] = null;
8774
- } else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
8775
- sanitizedProps[key] = value;
8776
- } else if (value instanceof Date) {
8777
- sanitizedProps[key] = value.toISOString();
8778
- } else {
8779
- sanitizedProps[key] = String(value);
8780
- }
8781
- });
8782
- }
8783
- const isFeatureSelected = (enableSelectionRef.current || enableDrawingRef.current) && selectedIdSet.has(featureId) ? 1 : 0;
8784
- let nonTracePriority = DEFAULT_LABEL_PRIORITY;
8785
- if (((_l = f.properties) == null ? void 0 : _l.kind) === "text") {
8786
- nonTracePriority = ((_m = f.properties) == null ? void 0 : _m.fontWeight) === "bold" ? 8 : 10;
8787
- } else {
8788
- const idStr = String(featureId);
8789
- let h = 0;
8790
- for (let i = 0; i < idStr.length; i++) {
8791
- h = (h << 5) - h + idStr.charCodeAt(i);
8792
- h |= 0;
8793
- }
8794
- nonTracePriority = DEFAULT_LABEL_PRIORITY + Math.abs(h) % 1e3;
8795
- }
8796
- const basePriority = traceLabel ? TRACE_ENDPOINT_LABEL_PRIORITY : nonTracePriority;
8797
- const labelPriority = isFeatureSelected ? 0 : basePriority;
8798
- if (traceEndpointRadius !== null) {
8799
- tracePointPaint.set(featureId, { name: nonTraceLabelText, endpointRadius: traceEndpointRadius, basePriority: nonTracePriority });
8800
- }
8801
- const visibleStrokeOpacity = hideFlatFor3DOnly ? 0 : baseOpacity;
8802
- const visibleFillOpacity = hideFlatFor3DOnly ? 0 : ((_n = f.properties) == null ? void 0 : _n["fill-opacity"]) ?? DEFAULT_VISIBLE_FILL_OPACITY;
8893
+ features: allFeatures.map((f, i) => {
8894
+ const styled = styleFeatureForPaint(f, featureToLayer.get(String(f.id)), paintContext, i >= drawFeatureCount);
8895
+ const p = styled.paint;
8803
8896
  recordPaintedFeature(
8804
8897
  paintCache,
8805
- featureId,
8806
- basePriority,
8807
- isFeatureSelected === 1,
8808
- visibleStrokeOpacity,
8809
- visibleFillOpacity,
8810
- !isTimelineVisible
8898
+ p.featureId,
8899
+ p.basePriority,
8900
+ p.selected,
8901
+ p.visibleStrokeOpacity,
8902
+ p.visibleFillOpacity,
8903
+ p.timelineHidden
8811
8904
  );
8812
- return {
8813
- type: "Feature",
8814
- id: featureId,
8815
- geometry: f.geometry,
8816
- properties: {
8817
- // Preserve original properties for tooltip display (sanitized)
8818
- ...sanitizedProps,
8819
- // Override with computed visual properties
8820
- id: featureId,
8821
- name: labelText,
8822
- isSelected: isFeatureSelected,
8823
- isHiddenByHeatmap: hideByHeatmap ? 1 : 0,
8824
- isHiddenByCluster: hideByCluster ? 1 : 0,
8825
- isHiddenByTrace: hideByTrace ? true : false,
8826
- isTracePoint: isTracePoint ? true : false,
8827
- isTraceLabel: traceLabel ? true : false,
8828
- icon: featureIcon || "",
8829
- iconSize: featureIconSize,
8830
- stroke: strokeColor,
8831
- "stroke-width": strokeWidth,
8832
- "stroke-opacity": isTimelineVisible ? visibleStrokeOpacity : 0,
8833
- fill: strokeColor,
8834
- "fill-opacity": isTimelineVisible ? visibleFillOpacity : 0,
8835
- pointRadius,
8836
- isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
8837
- isTimelineHidden: isTimelineVisible ? 0 : 1,
8838
- _labelPriority: labelPriority,
8839
- [LABEL_NEVER_HIDE_PROP]: computeLabelNeverHide((_o = layer == null ? void 0 : layer.visualConfig) == null ? void 0 : _o.label)
8840
- }
8841
- };
8905
+ if (styled.tracePaint) tracePointPaint.set(p.featureId, styled.tracePaint);
8906
+ return styled.feature;
8842
8907
  })
8843
8908
  };
8844
8909
  source.setData(sourceData);
@@ -9755,7 +9820,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9755
9820
  const buildBuiltinTooltipHtml = (feature) => {
9756
9821
  var _a2, _b;
9757
9822
  const props = feature.properties || {};
9758
- const featureId = String(props.id || feature.id);
9823
+ const featureId = String(feature.id ?? props.id ?? "");
9759
9824
  const currentLayers = layersRef.current;
9760
9825
  const featureLayer = currentLayers.find((l) => l.featureIds.includes(featureId));
9761
9826
  const visualConfig = featureLayer == null ? void 0 : featureLayer.visualConfig;
@@ -9814,6 +9879,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9814
9879
  const props = f.properties || {};
9815
9880
  return String(props._dvl_h3 || props.id || f.id || "");
9816
9881
  };
9882
+ const resolveRendered = (f) => resolveTooltipFeature(f, getFeatureById);
9817
9883
  const getFeatureAnchor = (f, fallback) => {
9818
9884
  const geom = f.geometry;
9819
9885
  if (geom.type === "Point") {
@@ -9886,7 +9952,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9886
9952
  id: f.id
9887
9953
  });
9888
9954
  };
9889
- addUnique(hoveredFeature);
9955
+ addUnique(resolveRendered(hoveredFeature));
9890
9956
  if (hoveredCoords) {
9891
9957
  const allFeatures = [];
9892
9958
  if (draw.current) {
@@ -9906,7 +9972,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9906
9972
  }
9907
9973
  }
9908
9974
  if (uniqueFeatures.length === 0) {
9909
- addUnique(hoveredFeature);
9975
+ addUnique(resolveRendered(hoveredFeature));
9910
9976
  }
9911
9977
  tooltipFeatures = uniqueFeatures;
9912
9978
  tooltipPageIndex = 0;
@@ -9947,12 +10013,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
9947
10013
  lastHoveredFeatureKey = currentKey;
9948
10014
  lastHoveredGeomType = geomType || null;
9949
10015
  const feature = e.features[0];
9950
- const featureObj = {
9951
- type: "Feature",
9952
- geometry: feature.geometry,
9953
- properties: { ...feature.properties || {} },
9954
- id: feature.id
9955
- };
10016
+ const featureObj = resolveRendered(feature);
9956
10017
  const anchorLngLat = isPolygon ? e.lngLat : getFeatureAnchor(feature, e.lngLat);
9957
10018
  tooltipFeatures = [featureObj];
9958
10019
  tooltipPageIndex = 0;