@lalalic/markcut 3.2.33 → 3.2.34
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.
|
@@ -223797,6 +223797,9 @@ function makeSyntheticLeg(from2, to, mode) {
|
|
|
223797
223797
|
steps: [{ path: greatCirclePath(from2, to), durationSec }]
|
|
223798
223798
|
};
|
|
223799
223799
|
}
|
|
223800
|
+
function routeMarkerGlyph(markerEmoji, activeMode) {
|
|
223801
|
+
return markerEmoji && markerEmoji !== "\u{1F697}" ? markerEmoji : activeMode ? modeEmoji(activeMode) : markerEmoji || "\u{1F4CD}";
|
|
223802
|
+
}
|
|
223800
223803
|
function modeEmoji(mode) {
|
|
223801
223804
|
switch ((mode ?? "").toUpperCase()) {
|
|
223802
223805
|
case "FLIGHT":
|
|
@@ -225048,7 +225051,7 @@ function RouteWithMarkerLegs({
|
|
|
225048
225051
|
const legs = useRouteLegs(waypoints, travelMode);
|
|
225049
225052
|
const stops = useRouteStops(children2, waypoints, legs);
|
|
225050
225053
|
const position7 = useAnimatedPositionLegs({ legs, actionDuration, stops });
|
|
225051
|
-
const glyph =
|
|
225054
|
+
const glyph = routeMarkerGlyph(markerEmoji, position7?.mode);
|
|
225052
225055
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
225053
225056
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RoutePolylines, { legs, routeColor, routeWeight }),
|
|
225054
225057
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(WaypointMarkers, { waypoints }),
|
package/src/types/Map.tsx
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
isSyntheticMode,
|
|
44
44
|
routePositionAtLegs,
|
|
45
45
|
modeEmoji,
|
|
46
|
+
routeMarkerGlyph,
|
|
46
47
|
type RouteLeg,
|
|
47
48
|
type RouteStopWindow,
|
|
48
49
|
} from "../utils/route-legs";
|
|
@@ -1007,7 +1008,7 @@ function RouteWithMarkerLegs({
|
|
|
1007
1008
|
const legs = useRouteLegs(waypoints, travelMode);
|
|
1008
1009
|
const stops = useRouteStops(children, waypoints, legs);
|
|
1009
1010
|
const position = useAnimatedPositionLegs({ legs, actionDuration, stops });
|
|
1010
|
-
const glyph =
|
|
1011
|
+
const glyph = routeMarkerGlyph(markerEmoji, position?.mode);
|
|
1011
1012
|
|
|
1012
1013
|
return (
|
|
1013
1014
|
<>
|
package/src/utils/route-legs.ts
CHANGED
|
@@ -102,6 +102,11 @@ export function makeSyntheticLeg(
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/** Emoji glyph for a leg's travel mode (used for the traveling marker). */
|
|
105
|
+
/** An explicitly authored marker must not be replaced by a guessed travel-mode glyph. */
|
|
106
|
+
export function routeMarkerGlyph(markerEmoji: string, activeMode?: string): string {
|
|
107
|
+
return markerEmoji && markerEmoji !== "🚗" ? markerEmoji : activeMode ? modeEmoji(activeMode) : markerEmoji || "📍";
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
export function modeEmoji(mode?: string): string {
|
|
106
111
|
switch ((mode ?? "").toUpperCase()) {
|
|
107
112
|
case "FLIGHT": return "✈️";
|
package/tests/route-legs.test.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
greatCirclePath,
|
|
5
5
|
makeSyntheticLeg,
|
|
6
6
|
modeEmoji,
|
|
7
|
+
routeMarkerGlyph,
|
|
7
8
|
routePositionAtLegs,
|
|
8
9
|
isSyntheticMode,
|
|
9
10
|
type RouteLeg,
|
|
@@ -176,3 +177,14 @@ describe("routePositionAtLegs", () => {
|
|
|
176
177
|
expect(noStop.mode).toBe("DRIVING");
|
|
177
178
|
});
|
|
178
179
|
});
|
|
180
|
+
|
|
181
|
+
describe('routeMarkerGlyph',()=>{
|
|
182
|
+
it('honors a custom neutral observation marker instead of inventing a vehicle',()=>{
|
|
183
|
+
expect(routeMarkerGlyph('📍','DRIVING')).toBe('📍');
|
|
184
|
+
expect(routeMarkerGlyph('📍','WALKING')).toBe('📍');
|
|
185
|
+
});
|
|
186
|
+
it('keeps the default transport-mode glyph when no custom marker is specified',()=>{
|
|
187
|
+
expect(routeMarkerGlyph('🚗','WALKING')).toBe('🚶');
|
|
188
|
+
expect(routeMarkerGlyph('🚗','DRIVING')).toBe('🚗');
|
|
189
|
+
});
|
|
190
|
+
});
|