Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix anth path #51

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"clsx": "^1.2.1",
"json-schema-yup-transformer": "2.0.0-beta.0",
"leaflet": "^1.9.4",
"leaflet-ant-path": "^1.3.0",
"leaflet.locatecontrol": "^0.79.0",
"lucide-react": "^0.221.0",
"next": "^13.5.4",
Expand Down
41 changes: 0 additions & 41 deletions src/components/map/ant-path.tsx

This file was deleted.

40 changes: 15 additions & 25 deletions src/components/map/geometry-item.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Fragment } from 'react';
import { Layer } from '@/api/settings';
import { GeoJsonProperties, Geometry } from 'geojson';
import { GeoJSONOptions } from 'leaflet';
Expand All @@ -11,7 +12,6 @@ import {
} from 'react-leaflet';

import { Icons } from '@/components/icons';
import AntPath, { AntPathOptions } from '@/components/map/ant-path';
import { DefaultMarker } from '@/components/map/default-marker';
import Popup from '@/components/map/popup';

Expand Down Expand Up @@ -108,33 +108,23 @@ export const GeometryItem = ({
return (
<>
{coordinatesAsMultiLineString.map((group, index) => {
if (layer.type === 'streams') {
return (
<AntPath
key={`linestring-${id}-${index}`}
return (
<Fragment key={`linestring-${id}-${index}`}>
{/* Duplicate streams layer to animate it */}
{layer.type === 'streams' && (
<Polyline
positions={group.map(([lat, lng]) => [lng, lat])}
pathOptions={options.style as GeoJSONOptions}
></Polyline>
)}
<Polyline
positions={group.map(([lat, lng]) => [lng, lat])}
options={
{
dashArray: ['30', '30'],
weight: 3,
delay: 2000,
...options.style,
} as AntPathOptions
}
pathOptions={options.style as GeoJSONOptions}
className={layer.type}
>
<MetaData properties={properties} layer={layer} />
</AntPath>
);
}

return (
<Polyline
key={`linestring-${id}-${index}`}
positions={group.map(([lat, lng]) => [lng, lat])}
pathOptions={options.style as GeoJSONOptions}
>
<MetaData properties={properties} layer={layer} />
</Polyline>
</Polyline>
</Fragment>
);
})}
</>
Expand Down
19 changes: 18 additions & 1 deletion src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,21 @@ body .leaflet-container a.leaflet-popup-close-button {

.tns-horizontal.tns-subpixel>.tns-item {
vertical-align: middle !important;
}
}

.streams.leaflet-interactive {
stroke-width: 2;
stroke: rgba(255, 255, 255, 0.6);
stroke-dasharray: 10;
stroke-dashoffset: 200;
animation-name: dash;
animation-duration: 20s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

@keyframes dash {
to {
stroke-dashoffset: 0;
}
}
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2636,11 +2636,6 @@ language-tags@=1.0.5:
dependencies:
language-subtag-registry "~0.3.2"

leaflet-ant-path@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/leaflet-ant-path/-/leaflet-ant-path-1.3.0.tgz#eac54e936e911666e61e9c2af682cba768b46a5a"
integrity sha512-wgWWcAD4w8QVguRsHh89NGj5eqwLOP6e/HazunW0fQaytqZqEh3WePWYIrmbUeMcOf2cX/+GecHkFfI5tirS1Q==

leaflet.locatecontrol@^0.79.0:
version "0.79.0"
resolved "https://registry.npmjs.org/leaflet.locatecontrol/-/leaflet.locatecontrol-0.79.0.tgz"
Expand Down
Loading