@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.mjs CHANGED
@@ -7113,6 +7113,269 @@ function hitTestSelection(featureGroups, selectionPolygon, options) {
7113
7113
  mapPerfLog("hit-test", "selection gesture", { visited, total, selected: selectedIds.length });
7114
7114
  return selectedIds;
7115
7115
  }
7116
+ const LABEL_NEVER_HIDE_PROP = "_labelNeverHide";
7117
+ const PINNED_LABEL_FILTER = ["==", ["get", LABEL_NEVER_HIDE_PROP], 1];
7118
+ const UNPINNED_LABEL_FILTER = ["!=", ["get", LABEL_NEVER_HIDE_PROP], 1];
7119
+ function computeLabelNeverHide(label) {
7120
+ return (label == null ? void 0 : label.neverHide) && !label.hidden ? 1 : 0;
7121
+ }
7122
+ function buildCustomLabelLayout() {
7123
+ return {
7124
+ // Hide labels for trace points (except last point which has isTraceLabel),
7125
+ // arrows handled by the custom-arrow-labels layer. Features blanked by
7126
+ // heatmap/cluster modes stay blank in BOTH layers: "never hide"
7127
+ // exempts labels from collision and density culling, it does not resurrect
7128
+ // labels other mode choices explicitly blank.
7129
+ "text-field": [
7130
+ "case",
7131
+ ["==", ["get", "isHiddenByHeatmap"], 1],
7132
+ "",
7133
+ ["==", ["get", "isHiddenByCluster"], 1],
7134
+ "",
7135
+ ["==", ["get", "kind"], "arrow"],
7136
+ "",
7137
+ // Trace points: only show label if isTraceLabel is true (last point in group)
7138
+ ["all", ["==", ["get", "isTracePoint"], true], ["!=", ["get", "isTraceLabel"], true]],
7139
+ "",
7140
+ ["==", ["get", "kind"], "text"],
7141
+ ["coalesce", ["get", "label"], ["get", "text"], "New Label"],
7142
+ ["coalesce", ["get", "name"], ""]
7143
+ ],
7144
+ // Text features use their fontSize property; trace labels 14px; others 12px
7145
+ "text-size": [
7146
+ "case",
7147
+ ["==", ["get", "kind"], "text"],
7148
+ ["coalesce", ["get", "fontSize"], 14],
7149
+ ["==", ["get", "isTraceLabel"], true],
7150
+ 14,
7151
+ 12
7152
+ ],
7153
+ // Text features: center anchor; others: top anchor
7154
+ "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
7155
+ "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
7156
+ "text-padding": 2,
7157
+ // Bold font for text features with fontWeight=bold, trace labels, others regular
7158
+ "text-font": [
7159
+ "case",
7160
+ ["all", ["==", ["get", "kind"], "text"], ["==", ["get", "fontWeight"], "bold"]],
7161
+ ["literal", ["Montserrat SemiBold", "Noto Sans Regular"]],
7162
+ ["==", ["get", "isTraceLabel"], true],
7163
+ ["literal", ["Montserrat Medium", "Noto Sans Regular"]],
7164
+ ["literal", ["Montserrat Regular", "Noto Sans Regular"]]
7165
+ ]
7166
+ };
7167
+ }
7168
+ function buildCustomLabelPaint() {
7169
+ return {
7170
+ // Text features use fontColor; others use default
7171
+ "text-color": [
7172
+ "case",
7173
+ ["==", ["get", "kind"], "text"],
7174
+ ["coalesce", ["get", "fontColor"], "#000000"],
7175
+ "#1f2937"
7176
+ ],
7177
+ "text-halo-color": "#ffffff",
7178
+ // Thicker halo for trace labels and text features
7179
+ "text-halo-width": [
7180
+ "case",
7181
+ ["==", ["get", "kind"], "text"],
7182
+ 2,
7183
+ ["==", ["get", "isTraceLabel"], true],
7184
+ 2,
7185
+ 1.5
7186
+ ],
7187
+ "text-opacity": ["*", 0.9, ["get", "stroke-opacity"]]
7188
+ };
7189
+ }
7190
+ const RENDER_PASSTHROUGH_KEYS = ["_dvl_h3"];
7191
+ const ANNOTATION_PASSTHROUGH_KEYS = [
7192
+ "kind",
7193
+ "text",
7194
+ "label",
7195
+ "fontSize",
7196
+ "fontColor",
7197
+ "fontWeight",
7198
+ "arrowSize"
7199
+ ];
7200
+ function sanitizeValue(value) {
7201
+ if (value === null || value === void 0) return null;
7202
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
7203
+ if (value instanceof Date) return value.toISOString();
7204
+ return String(value);
7205
+ }
7206
+ function styleFeatureForPaint(f, layer, ctx, slim) {
7207
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
7208
+ const featureId = String(f.id);
7209
+ const visualConfig = layer == null ? void 0 : layer.visualConfig;
7210
+ const isTimelineVisible = ctx.timelineVisibleIds === null || ctx.timelineVisibleIds.has(featureId);
7211
+ const baseOpacity = ((_a = f.properties) == null ? void 0 : _a["stroke-opacity"]) ?? DEFAULT_VISIBLE_STROKE_OPACITY;
7212
+ let strokeColor = ((_b = f.properties) == null ? void 0 : _b.stroke) || "#3b82f6";
7213
+ const colorConfig = visualConfig == null ? void 0 : visualConfig.color;
7214
+ if (colorConfig) {
7215
+ strokeColor = resolveFeatureColor(
7216
+ colorConfig,
7217
+ f.properties,
7218
+ strokeColor,
7219
+ layer ? ctx.colorFieldRanges.get(layer.id) : void 0
7220
+ );
7221
+ }
7222
+ let strokeWidth = ((_c = f.properties) == null ? void 0 : _c["stroke-width"]) || 2;
7223
+ let pointRadius = Math.round(3 + strokeWidth);
7224
+ const sizeConfig = visualConfig == null ? void 0 : visualConfig.size;
7225
+ if (sizeConfig) {
7226
+ if (sizeConfig.mode === "override" && sizeConfig.overrideValue !== void 0) {
7227
+ strokeWidth = Math.max(1, Math.min(10, sizeConfig.overrideValue));
7228
+ pointRadius = Math.round(3 + strokeWidth);
7229
+ } else if (sizeConfig.mode === "field" && sizeConfig.fieldName && layer) {
7230
+ const range = ctx.sizeFieldRanges.get(layer.id);
7231
+ if (range && f.properties) {
7232
+ const rawVal = f.properties[sizeConfig.fieldName];
7233
+ const val = typeof rawVal === "number" ? rawVal : typeof rawVal === "string" && rawVal.trim() !== "" ? Number(rawVal) : NaN;
7234
+ if (isFinite(val)) {
7235
+ const normalized = range.max > range.min ? (val - range.min) / (range.max - range.min) : 0.5;
7236
+ strokeWidth = 2 + normalized * 8;
7237
+ pointRadius = Math.round(2 + normalized * 16);
7238
+ }
7239
+ }
7240
+ }
7241
+ }
7242
+ const isTracePoint = ctx.tracePointIds.has(featureId);
7243
+ const isLastTracePoint = ctx.lastTracePointIds.has(featureId);
7244
+ const traceLabel = ctx.lastTracePointLabels.get(featureId);
7245
+ let traceEndpointRadius = null;
7246
+ if (isTracePoint && f.geometry.type === "Point") {
7247
+ strokeColor = ctx.tracePointColors.get(featureId) || strokeColor;
7248
+ traceEndpointRadius = Math.max(pointRadius, TRACE_ENDPOINT_MIN_RADIUS);
7249
+ pointRadius = isLastTracePoint ? traceEndpointRadius : TRACE_POINT_RADIUS;
7250
+ }
7251
+ let labelText = ((_d = f.properties) == null ? void 0 : _d.name) || "";
7252
+ const labelConfig = visualConfig == null ? void 0 : visualConfig.label;
7253
+ if (labelConfig == null ? void 0 : labelConfig.hidden) {
7254
+ labelText = "";
7255
+ } else if (labelConfig) {
7256
+ if (labelConfig.mode === "fixed" && labelConfig.fixedText) {
7257
+ labelText = labelConfig.fixedText;
7258
+ } else if (labelConfig.mode === "field" && labelConfig.fieldName && f.properties) {
7259
+ const fieldValue = f.properties[labelConfig.fieldName];
7260
+ labelText = fieldValue !== void 0 && fieldValue !== null ? String(fieldValue) : "";
7261
+ }
7262
+ }
7263
+ const nonTraceLabelText = labelText;
7264
+ if (traceLabel) {
7265
+ labelText = traceLabel;
7266
+ }
7267
+ let featureIcon = ((_e = f.properties) == null ? void 0 : _e.pointIcon) || ((_f = f.properties) == null ? void 0 : _f.icon);
7268
+ let featureIconSize = ((_g = f.properties) == null ? void 0 : _g.pointIconSize) || ((_h = f.properties) == null ? void 0 : _h.iconSize) || 24;
7269
+ const iconConfig = visualConfig == null ? void 0 : visualConfig.icon;
7270
+ if ((iconConfig == null ? void 0 : iconConfig.enabled) && iconConfig.icon && !featureIcon) {
7271
+ featureIcon = iconConfig.icon;
7272
+ featureIconSize = iconConfig.size ?? 24;
7273
+ }
7274
+ const isPoint = f.geometry.type === "Point";
7275
+ const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
7276
+ 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);
7277
+ const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
7278
+ const hideFlatFor3DOnly = isLine && (layer == null ? void 0 : layer.hasAltitudeData) && (layer == null ? void 0 : layer.altitudeDisplayMode) === "3d";
7279
+ const sanitizedProps = {};
7280
+ const props = f.properties;
7281
+ if (props) {
7282
+ if (slim) {
7283
+ RENDER_PASSTHROUGH_KEYS.forEach((key) => {
7284
+ if (key in props) sanitizedProps[key] = sanitizeValue(props[key]);
7285
+ });
7286
+ if (typeof props.kind === "string") {
7287
+ ANNOTATION_PASSTHROUGH_KEYS.forEach((key) => {
7288
+ if (key in props) sanitizedProps[key] = sanitizeValue(props[key]);
7289
+ });
7290
+ }
7291
+ } else {
7292
+ Object.entries(props).forEach(([key, value]) => {
7293
+ sanitizedProps[key] = sanitizeValue(value);
7294
+ });
7295
+ }
7296
+ }
7297
+ const isFeatureSelected = ctx.selectionEnabled && ctx.selectedIds.has(featureId) ? 1 : 0;
7298
+ let nonTracePriority = DEFAULT_LABEL_PRIORITY;
7299
+ if (((_l = f.properties) == null ? void 0 : _l.kind) === "text") {
7300
+ nonTracePriority = ((_m = f.properties) == null ? void 0 : _m.fontWeight) === "bold" ? 8 : 10;
7301
+ } else {
7302
+ const idStr = String(featureId);
7303
+ let h = 0;
7304
+ for (let i = 0; i < idStr.length; i++) {
7305
+ h = (h << 5) - h + idStr.charCodeAt(i);
7306
+ h |= 0;
7307
+ }
7308
+ nonTracePriority = DEFAULT_LABEL_PRIORITY + Math.abs(h) % 1e3;
7309
+ }
7310
+ const basePriority = traceLabel ? TRACE_ENDPOINT_LABEL_PRIORITY : nonTracePriority;
7311
+ const labelPriority = isFeatureSelected ? 0 : basePriority;
7312
+ const visibleStrokeOpacity = hideFlatFor3DOnly ? 0 : baseOpacity;
7313
+ const visibleFillOpacity = hideFlatFor3DOnly ? 0 : ((_n = f.properties) == null ? void 0 : _n["fill-opacity"]) ?? DEFAULT_VISIBLE_FILL_OPACITY;
7314
+ return {
7315
+ feature: {
7316
+ type: "Feature",
7317
+ id: featureId,
7318
+ geometry: f.geometry,
7319
+ properties: {
7320
+ // Record fields (draw features) or just the passthroughs (read-only)
7321
+ ...sanitizedProps,
7322
+ // Override with computed visual properties
7323
+ id: featureId,
7324
+ name: labelText,
7325
+ isSelected: isFeatureSelected,
7326
+ isHiddenByHeatmap: hideByHeatmap ? 1 : 0,
7327
+ isHiddenByCluster: hideByCluster ? 1 : 0,
7328
+ isTracePoint: isTracePoint ? true : false,
7329
+ isTraceLabel: traceLabel ? true : false,
7330
+ icon: featureIcon || "",
7331
+ iconSize: featureIconSize,
7332
+ stroke: strokeColor,
7333
+ "stroke-width": strokeWidth,
7334
+ "stroke-opacity": isTimelineVisible ? visibleStrokeOpacity : 0,
7335
+ fill: strokeColor,
7336
+ "fill-opacity": isTimelineVisible ? visibleFillOpacity : 0,
7337
+ pointRadius,
7338
+ isTimelineHidden: isTimelineVisible ? 0 : 1,
7339
+ _labelPriority: labelPriority,
7340
+ [LABEL_NEVER_HIDE_PROP]: computeLabelNeverHide((_o = layer == null ? void 0 : layer.visualConfig) == null ? void 0 : _o.label)
7341
+ }
7342
+ },
7343
+ paint: {
7344
+ featureId,
7345
+ basePriority,
7346
+ selected: isFeatureSelected === 1,
7347
+ visibleStrokeOpacity,
7348
+ visibleFillOpacity,
7349
+ timelineHidden: !isTimelineVisible
7350
+ },
7351
+ tracePaint: traceEndpointRadius !== null ? { name: nonTraceLabelText, endpointRadius: traceEndpointRadius, basePriority: nonTracePriority } : null
7352
+ };
7353
+ }
7354
+ function renderedFeatureId(f) {
7355
+ var _a;
7356
+ const fromProps = (_a = f.properties) == null ? void 0 : _a.id;
7357
+ if (fromProps !== void 0 && fromProps !== null && fromProps !== "") return String(fromProps);
7358
+ if (f.id !== void 0 && f.id !== null && f.id !== "") return String(f.id);
7359
+ return null;
7360
+ }
7361
+ function resolveTooltipFeature(rendered, lookup) {
7362
+ const id = renderedFeatureId(rendered);
7363
+ const stored = id === null ? null : lookup(id);
7364
+ if (stored) {
7365
+ return deepClone({
7366
+ type: "Feature",
7367
+ geometry: stored.geometry,
7368
+ properties: stored.properties ?? {},
7369
+ id: stored.id
7370
+ });
7371
+ }
7372
+ return {
7373
+ type: "Feature",
7374
+ geometry: rendered.geometry,
7375
+ properties: { ...rendered.properties ?? {} },
7376
+ id: rendered.id
7377
+ };
7378
+ }
7116
7379
  const CLUSTER_COUNT_VALUE_PROP = "__cluster_count_value";
7117
7380
  const CLUSTER_SUM_PROP = "value_sum";
7118
7381
  const CLUSTER_MEMBER_ID_PROP = "__cluster_fid";
@@ -7306,82 +7569,6 @@ function createClusterGradientManager(map, sourceId, options) {
7306
7569
  }
7307
7570
  };
7308
7571
  }
7309
- const LABEL_NEVER_HIDE_PROP = "_labelNeverHide";
7310
- const PINNED_LABEL_FILTER = ["==", ["get", LABEL_NEVER_HIDE_PROP], 1];
7311
- const UNPINNED_LABEL_FILTER = ["!=", ["get", LABEL_NEVER_HIDE_PROP], 1];
7312
- function computeLabelNeverHide(label) {
7313
- return (label == null ? void 0 : label.neverHide) && !label.hidden ? 1 : 0;
7314
- }
7315
- function buildCustomLabelLayout() {
7316
- return {
7317
- // Hide labels for trace points (except last point which has isTraceLabel),
7318
- // arrows handled by the custom-arrow-labels layer. Features blanked by
7319
- // heatmap/cluster/trace modes stay blank in BOTH layers: "never hide"
7320
- // exempts labels from collision and density culling, it does not resurrect
7321
- // labels other mode choices explicitly blank.
7322
- "text-field": [
7323
- "case",
7324
- ["==", ["get", "isHiddenByTrace"], true],
7325
- "",
7326
- ["==", ["get", "isHiddenByHeatmap"], 1],
7327
- "",
7328
- ["==", ["get", "isHiddenByCluster"], 1],
7329
- "",
7330
- ["==", ["get", "kind"], "arrow"],
7331
- "",
7332
- // Trace points: only show label if isTraceLabel is true (last point in group)
7333
- ["all", ["==", ["get", "isTracePoint"], true], ["!=", ["get", "isTraceLabel"], true]],
7334
- "",
7335
- ["==", ["get", "kind"], "text"],
7336
- ["coalesce", ["get", "label"], ["get", "text"], "New Label"],
7337
- ["coalesce", ["get", "name"], ""]
7338
- ],
7339
- // Text features use their fontSize property; trace labels 14px; others 12px
7340
- "text-size": [
7341
- "case",
7342
- ["==", ["get", "kind"], "text"],
7343
- ["coalesce", ["get", "fontSize"], 14],
7344
- ["==", ["get", "isTraceLabel"], true],
7345
- 14,
7346
- 12
7347
- ],
7348
- // Text features: center anchor; others: top anchor
7349
- "text-anchor": ["case", ["==", ["get", "kind"], "text"], "center", "top"],
7350
- "text-offset": ["case", ["==", ["get", "kind"], "text"], ["literal", [0, 0]], ["literal", [0, 0.8]]],
7351
- "text-padding": 2,
7352
- // Bold font for text features with fontWeight=bold, trace labels, others regular
7353
- "text-font": [
7354
- "case",
7355
- ["all", ["==", ["get", "kind"], "text"], ["==", ["get", "fontWeight"], "bold"]],
7356
- ["literal", ["Montserrat SemiBold", "Noto Sans Regular"]],
7357
- ["==", ["get", "isTraceLabel"], true],
7358
- ["literal", ["Montserrat Medium", "Noto Sans Regular"]],
7359
- ["literal", ["Montserrat Regular", "Noto Sans Regular"]]
7360
- ]
7361
- };
7362
- }
7363
- function buildCustomLabelPaint() {
7364
- return {
7365
- // Text features use fontColor; others use default
7366
- "text-color": [
7367
- "case",
7368
- ["==", ["get", "kind"], "text"],
7369
- ["coalesce", ["get", "fontColor"], "#000000"],
7370
- "#1f2937"
7371
- ],
7372
- "text-halo-color": "#ffffff",
7373
- // Thicker halo for trace labels and text features
7374
- "text-halo-width": [
7375
- "case",
7376
- ["==", ["get", "kind"], "text"],
7377
- 2,
7378
- ["==", ["get", "isTraceLabel"], true],
7379
- 2,
7380
- 1.5
7381
- ],
7382
- "text-opacity": ["*", 0.9, ["get", "stroke-opacity"]]
7383
- };
7384
- }
7385
7572
  const OTHER_BUCKET_KEY = "__other__";
7386
7573
  const OTHER_BUCKET_LABEL = "Other";
7387
7574
  const OTHER_BUCKET_COLOR = "#9ca3af";
@@ -8669,156 +8856,34 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
8669
8856
  }
8670
8857
  });
8671
8858
  const paintCache = createSelectionPaintCache();
8859
+ const paintContext = {
8860
+ timelineVisibleIds: visibleSet,
8861
+ selectedIds: selectedIdSet,
8862
+ selectionEnabled: enableSelectionRef.current || enableDrawingRef.current,
8863
+ sizeFieldRanges,
8864
+ colorFieldRanges,
8865
+ tracePointIds,
8866
+ lastTracePointIds,
8867
+ lastTracePointLabels,
8868
+ tracePointColors
8869
+ };
8870
+ const drawFeatureCount = drawFeatures.features.length;
8672
8871
  const sourceData = {
8673
8872
  type: "FeatureCollection",
8674
- features: allFeatures.map((f) => {
8675
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
8676
- const featureId = String(f.id);
8677
- const layer = featureToLayer.get(featureId);
8678
- const visualConfig = layer == null ? void 0 : layer.visualConfig;
8679
- const isTimelineVisible = visibleSet === null || visibleSet.has(featureId);
8680
- const baseOpacity = ((_a = f.properties) == null ? void 0 : _a["stroke-opacity"]) ?? DEFAULT_VISIBLE_STROKE_OPACITY;
8681
- let strokeColor = ((_b = f.properties) == null ? void 0 : _b.stroke) || "#3b82f6";
8682
- const colorConfig = visualConfig == null ? void 0 : visualConfig.color;
8683
- if (colorConfig) {
8684
- strokeColor = resolveFeatureColor(
8685
- colorConfig,
8686
- f.properties,
8687
- strokeColor,
8688
- layer ? colorFieldRanges.get(layer.id) : void 0
8689
- );
8690
- }
8691
- let strokeWidth = ((_c = f.properties) == null ? void 0 : _c["stroke-width"]) || 2;
8692
- let pointRadius = Math.round(3 + strokeWidth);
8693
- const sizeConfig = visualConfig == null ? void 0 : visualConfig.size;
8694
- if (sizeConfig) {
8695
- if (sizeConfig.mode === "override" && sizeConfig.overrideValue !== void 0) {
8696
- strokeWidth = Math.max(1, Math.min(10, sizeConfig.overrideValue));
8697
- pointRadius = Math.round(3 + strokeWidth);
8698
- } else if (sizeConfig.mode === "field" && sizeConfig.fieldName && layer) {
8699
- const range = sizeFieldRanges.get(layer.id);
8700
- if (range && f.properties) {
8701
- const rawVal = f.properties[sizeConfig.fieldName];
8702
- const val = typeof rawVal === "number" ? rawVal : typeof rawVal === "string" && rawVal.trim() !== "" ? Number(rawVal) : NaN;
8703
- if (isFinite(val)) {
8704
- const normalized = range.max > range.min ? (val - range.min) / (range.max - range.min) : 0.5;
8705
- strokeWidth = 2 + normalized * 8;
8706
- pointRadius = Math.round(2 + normalized * 16);
8707
- }
8708
- }
8709
- }
8710
- }
8711
- const isTracePoint = tracePointIds.has(featureId);
8712
- const isLastTracePoint = lastTracePointIds.has(featureId);
8713
- const traceLabel = lastTracePointLabels.get(featureId);
8714
- let traceEndpointRadius = null;
8715
- if (isTracePoint && f.geometry.type === "Point") {
8716
- strokeColor = tracePointColors.get(featureId) || strokeColor;
8717
- traceEndpointRadius = Math.max(pointRadius, TRACE_ENDPOINT_MIN_RADIUS);
8718
- pointRadius = isLastTracePoint ? traceEndpointRadius : TRACE_POINT_RADIUS;
8719
- }
8720
- let labelText = ((_d = f.properties) == null ? void 0 : _d.name) || "";
8721
- const labelConfig = visualConfig == null ? void 0 : visualConfig.label;
8722
- if (labelConfig == null ? void 0 : labelConfig.hidden) {
8723
- labelText = "";
8724
- } else if (labelConfig) {
8725
- if (labelConfig.mode === "fixed" && labelConfig.fixedText) {
8726
- labelText = labelConfig.fixedText;
8727
- } else if (labelConfig.mode === "field" && labelConfig.fieldName && f.properties) {
8728
- const fieldValue = f.properties[labelConfig.fieldName];
8729
- labelText = fieldValue !== void 0 && fieldValue !== null ? String(fieldValue) : "";
8730
- }
8731
- }
8732
- const nonTraceLabelText = labelText;
8733
- if (traceLabel) {
8734
- labelText = traceLabel;
8735
- }
8736
- let featureIcon = ((_e = f.properties) == null ? void 0 : _e.pointIcon) || ((_f = f.properties) == null ? void 0 : _f.icon);
8737
- let featureIconSize = ((_g = f.properties) == null ? void 0 : _g.pointIconSize) || ((_h = f.properties) == null ? void 0 : _h.iconSize) || 24;
8738
- const iconConfig = visualConfig == null ? void 0 : visualConfig.icon;
8739
- if ((iconConfig == null ? void 0 : iconConfig.enabled) && iconConfig.icon && !featureIcon) {
8740
- featureIcon = iconConfig.icon;
8741
- featureIconSize = iconConfig.size ?? 24;
8742
- }
8743
- const isPoint = f.geometry.type === "Point";
8744
- const hideByHeatmap = isPoint && ((_i = layer == null ? void 0 : layer.heatmapConfig) == null ? void 0 : _i.enabled) === true;
8745
- 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);
8746
- const hideByTrace = false;
8747
- const isLine = f.geometry.type === "LineString" || f.geometry.type === "MultiLineString";
8748
- const hideFlatFor3DOnly = isLine && (layer == null ? void 0 : layer.hasAltitudeData) && (layer == null ? void 0 : layer.altitudeDisplayMode) === "3d";
8749
- const sanitizedProps = {};
8750
- if (f.properties) {
8751
- Object.entries(f.properties).forEach(([key, value]) => {
8752
- if (value === null || value === void 0) {
8753
- sanitizedProps[key] = null;
8754
- } else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
8755
- sanitizedProps[key] = value;
8756
- } else if (value instanceof Date) {
8757
- sanitizedProps[key] = value.toISOString();
8758
- } else {
8759
- sanitizedProps[key] = String(value);
8760
- }
8761
- });
8762
- }
8763
- const isFeatureSelected = (enableSelectionRef.current || enableDrawingRef.current) && selectedIdSet.has(featureId) ? 1 : 0;
8764
- let nonTracePriority = DEFAULT_LABEL_PRIORITY;
8765
- if (((_l = f.properties) == null ? void 0 : _l.kind) === "text") {
8766
- nonTracePriority = ((_m = f.properties) == null ? void 0 : _m.fontWeight) === "bold" ? 8 : 10;
8767
- } else {
8768
- const idStr = String(featureId);
8769
- let h = 0;
8770
- for (let i = 0; i < idStr.length; i++) {
8771
- h = (h << 5) - h + idStr.charCodeAt(i);
8772
- h |= 0;
8773
- }
8774
- nonTracePriority = DEFAULT_LABEL_PRIORITY + Math.abs(h) % 1e3;
8775
- }
8776
- const basePriority = traceLabel ? TRACE_ENDPOINT_LABEL_PRIORITY : nonTracePriority;
8777
- const labelPriority = isFeatureSelected ? 0 : basePriority;
8778
- if (traceEndpointRadius !== null) {
8779
- tracePointPaint.set(featureId, { name: nonTraceLabelText, endpointRadius: traceEndpointRadius, basePriority: nonTracePriority });
8780
- }
8781
- const visibleStrokeOpacity = hideFlatFor3DOnly ? 0 : baseOpacity;
8782
- const visibleFillOpacity = hideFlatFor3DOnly ? 0 : ((_n = f.properties) == null ? void 0 : _n["fill-opacity"]) ?? DEFAULT_VISIBLE_FILL_OPACITY;
8873
+ features: allFeatures.map((f, i) => {
8874
+ const styled = styleFeatureForPaint(f, featureToLayer.get(String(f.id)), paintContext, i >= drawFeatureCount);
8875
+ const p = styled.paint;
8783
8876
  recordPaintedFeature(
8784
8877
  paintCache,
8785
- featureId,
8786
- basePriority,
8787
- isFeatureSelected === 1,
8788
- visibleStrokeOpacity,
8789
- visibleFillOpacity,
8790
- !isTimelineVisible
8878
+ p.featureId,
8879
+ p.basePriority,
8880
+ p.selected,
8881
+ p.visibleStrokeOpacity,
8882
+ p.visibleFillOpacity,
8883
+ p.timelineHidden
8791
8884
  );
8792
- return {
8793
- type: "Feature",
8794
- id: featureId,
8795
- geometry: f.geometry,
8796
- properties: {
8797
- // Preserve original properties for tooltip display (sanitized)
8798
- ...sanitizedProps,
8799
- // Override with computed visual properties
8800
- id: featureId,
8801
- name: labelText,
8802
- isSelected: isFeatureSelected,
8803
- isHiddenByHeatmap: hideByHeatmap ? 1 : 0,
8804
- isHiddenByCluster: hideByCluster ? 1 : 0,
8805
- isHiddenByTrace: hideByTrace ? true : false,
8806
- isTracePoint: isTracePoint ? true : false,
8807
- isTraceLabel: traceLabel ? true : false,
8808
- icon: featureIcon || "",
8809
- iconSize: featureIconSize,
8810
- stroke: strokeColor,
8811
- "stroke-width": strokeWidth,
8812
- "stroke-opacity": isTimelineVisible ? visibleStrokeOpacity : 0,
8813
- fill: strokeColor,
8814
- "fill-opacity": isTimelineVisible ? visibleFillOpacity : 0,
8815
- pointRadius,
8816
- isHiddenFor3DOnly: hideFlatFor3DOnly ? 1 : 0,
8817
- isTimelineHidden: isTimelineVisible ? 0 : 1,
8818
- _labelPriority: labelPriority,
8819
- [LABEL_NEVER_HIDE_PROP]: computeLabelNeverHide((_o = layer == null ? void 0 : layer.visualConfig) == null ? void 0 : _o.label)
8820
- }
8821
- };
8885
+ if (styled.tracePaint) tracePointPaint.set(p.featureId, styled.tracePaint);
8886
+ return styled.feature;
8822
8887
  })
8823
8888
  };
8824
8889
  source.setData(sourceData);
@@ -9735,7 +9800,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9735
9800
  const buildBuiltinTooltipHtml = (feature) => {
9736
9801
  var _a2, _b;
9737
9802
  const props = feature.properties || {};
9738
- const featureId = String(props.id || feature.id);
9803
+ const featureId = String(feature.id ?? props.id ?? "");
9739
9804
  const currentLayers = layersRef.current;
9740
9805
  const featureLayer = currentLayers.find((l) => l.featureIds.includes(featureId));
9741
9806
  const visualConfig = featureLayer == null ? void 0 : featureLayer.visualConfig;
@@ -9794,6 +9859,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9794
9859
  const props = f.properties || {};
9795
9860
  return String(props._dvl_h3 || props.id || f.id || "");
9796
9861
  };
9862
+ const resolveRendered = (f) => resolveTooltipFeature(f, getFeatureById);
9797
9863
  const getFeatureAnchor = (f, fallback) => {
9798
9864
  const geom = f.geometry;
9799
9865
  if (geom.type === "Point") {
@@ -9866,7 +9932,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9866
9932
  id: f.id
9867
9933
  });
9868
9934
  };
9869
- addUnique(hoveredFeature);
9935
+ addUnique(resolveRendered(hoveredFeature));
9870
9936
  if (hoveredCoords) {
9871
9937
  const allFeatures = [];
9872
9938
  if (draw.current) {
@@ -9886,7 +9952,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9886
9952
  }
9887
9953
  }
9888
9954
  if (uniqueFeatures.length === 0) {
9889
- addUnique(hoveredFeature);
9955
+ addUnique(resolveRendered(hoveredFeature));
9890
9956
  }
9891
9957
  tooltipFeatures = uniqueFeatures;
9892
9958
  tooltipPageIndex = 0;
@@ -9927,12 +9993,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9927
9993
  lastHoveredFeatureKey = currentKey;
9928
9994
  lastHoveredGeomType = geomType || null;
9929
9995
  const feature = e.features[0];
9930
- const featureObj = {
9931
- type: "Feature",
9932
- geometry: feature.geometry,
9933
- properties: { ...feature.properties || {} },
9934
- id: feature.id
9935
- };
9996
+ const featureObj = resolveRendered(feature);
9936
9997
  const anchorLngLat = isPolygon ? e.lngLat : getFeatureAnchor(feature, e.lngLat);
9937
9998
  tooltipFeatures = [featureObj];
9938
9999
  tooltipPageIndex = 0;